11 2015 档案
摘要:1 #import "ViewController.h" 2 3 @interface ViewController () 4 { 5 //创建数据源 6 NSMutableArray * _dataArray; 7 8 } 9 10 @end 11...
阅读全文
摘要:1 //创建一个全屏大小的scrollerView 2 UIScrollView * scrollerView = [[UIScrollView alloc]initWithFrame:self.view.bounds] ; 3 //添加到self.view上 4 [sel...
阅读全文
摘要:webView使用loadRequest: 方法请求数据的加载 1 - (void)createWebView{ 2 //创建全屏大小的webView 3 UIWebView * view = [[UIWebView alloc]initWithFrame:self.view.bou...
阅读全文
摘要:UITabBarController的创建与基本属性 1 - (void)customTabbarController{ 2 3 //声明一个UITabBarController 4 UITabBarController * tab = [[UITabBarCont...
阅读全文
摘要:一.UITouch 1 //任何视图都可以触发此方法 2 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 3 NSLog(@"视图被触摸了"); 4 } 5 6 - (void)touchesCancel...
阅读全文
摘要:创建文本输入框 UITextField * textField = [[UITextField alloc]initWithFrame:CGRectMake(50, 50, 250, 40)];设置边框样式 textField.borderStyle = UITextBorderStyl...
阅读全文
摘要:创建UITextView//创建一个单例对象 存储_str字符串 NSUserDefaults * hd = [NSUserDefaults standardUserDefaults]; _str = [hd objectForKey:@"str"]; UIText...
阅读全文
摘要:UIStepper * stepper = [[UIStepper alloc]initWithFrame:CGRectMake(50, 100, 150, 40)]; //********最小值和最大值 stepper.maximumValue = 100; ste...
阅读全文
摘要:创建分段选择器 UISegmentedControl * sc = [[UISegmentedControl alloc]initWithFrame:CGRectMake(50, 100, 200, 30)]; [sc insertSegmentWithTitle:@"第一页" ...
阅读全文
摘要:创建ProgressView UIProgressView * progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(50, 100, 200, 10)]; progressView.progressView...
阅读全文
摘要:创建提示框 //创建提示框 //标题 提示内容 代理对象 按钮 UIAlertView * alertView = [[UIAlertView alloc]initWithTitle:@"警告" message:@"萨达姆已经做好战斗准备" delegate:self ca...
阅读全文
摘要:创建UIActivityIndicatorView UIActivityIndicatorView * AIV = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(50, 50, 50, 50)]; //设置样式 ...
阅读全文
摘要:UIActionSheet在iOS8.3之后已不建议使用。 可以使用UIAlertController+UIAlertControllerStyleActionSheet获得同样的效果创建UIActionSheet UIActionSheet * as = [[UIActionSheet al...
阅读全文
摘要:把NavigationController设为根视图控制器 FirstViewController * firstVC = [[FirstViewController alloc]init]; UINavigationController * nc = [[UINavig...
阅读全文
摘要:UIViewController的生命周期- (void)loadView{} 用于创建self.view- (void)viewDidLoad{} self.view创建完毕- (void)viewWillAppear:(BOOL)animated{}视图即将显示- (void)viewDidAp...
阅读全文
摘要:创建一个UIImageView //创建UIImageView 根据图片大小 UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 80, size.width, size.height)];...
阅读全文
摘要:UIView的几个主要属性1 /*2 CGRect frame;3 4 CGRect bounds;5 6 CGPoint center;7 8 CGAffin...
阅读全文
摘要:创建Button //创建一个button UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; //枚举类型 /* typedef NS_ENUM(NSInteger, UIButtonT...
阅读全文
摘要:创建label //创建标签对象 UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(50, 50, 300, 105)];添加标示 //添加标示 label.tag = 1;设置label文字 //设置...
阅读全文
摘要:前些天学到了Block,对于Block有了一些大致的认识Block是什么?我认为是一些行为的封装举个例子 要将两个参数进行加减乘除 创建4个Block实现价钱乘除四个操作即可 用一个方法 传两个参数和一个block 返回就是block对这两个参数的操作代码演示 1 #import 2 #impo...
阅读全文
摘要:浅拷贝不产生新的对象 深拷贝需要重新创建对象没啥说的 看代码 1 #import 2 #import "Person.h" 3 int main(int argc, const char * argv[]) { 4 @autoreleasepool { 5 // 浅拷贝 不...
阅读全文
摘要:13寸的MacBook Pro 有三款基本款都是i5 差距很小 重点在于闪存(硬盘大小)128G (足够开发) 256G(日常使用基本够用) 512G(太他妈贵了)可以选配i7和16G内存 不过13寸用16G内存 基本是用不上的价格如下 这个i7和15寸的i7不同 这个是双核4线程13寸的装...
阅读全文
摘要:周六周日补齐 代理block文件管理plist归档json数据解析
阅读全文
摘要:1.代理初识假设BOSS需要买电脑 让worker去买 这时boss需要一个代理即为worker 去买电脑BOSS创建一个协议 协议中的方法为买电脑BOSS有一个属性 属性的类为遵守协议的类BOSS有一个成员方法 方法的实现为 代理去买电脑worker类需要遵守协议 实现协议方法 买电脑代码实现...
阅读全文
摘要:1 #import 2 #import "IOSProgrammer.h" 3 #import "JavaCodingMonkey.h" 4 int main(int argc, const char * argv[]) { 5 @autoreleasepool { 6 ...
阅读全文
摘要:1.内存管理中的基本问题 1.1为什么要进行内存管理 分配在堆空间中的对象 需要手动去释放回顾堆栈的区别 生命周期栈空间 函数 函数中局部变量 调用函数压栈 函数调用结束 释放 数据段 静态变...
阅读全文
摘要:1 #import 2 // MVC 设计思想 3 // Model 数据模型 4 // View 视图 5 // Controller 控制器 6 #import "ContactBook.h" 7 int main(int argc, const char * argv[]) { 8 ...
阅读全文
摘要:1 #import 2 #import "LRCManager.h"3 int main(int argc, const char * argv[]) {4 @autoreleasepool {5 [LRCManager test];6 }7 return 0...
阅读全文
摘要:// // 创建学生类 姓名 学号 年龄 成绩// 创建五个学生对象,加入数组, 分别按姓名升序 学号降序 年龄升序 成绩降序排序main.m 1 #import 2 #import "Student.h" 3 int main(int argc, const char * argv[]) { 4...
阅读全文
摘要:NSArray 有序的 自然顺序NSSet 无序的NSSet 中不能存储重复的数据,可以用它来去除重复的数据1.创建集合 1.1创建不可变集合 1 NSSet * set = [[NSSet alloc] initWithObjects:@"one",@"two",@"three",...
阅读全文
摘要:字典中存放的是键值对 可通过键取得值1.创建不可变字典1 // 1 f(1)2 NSDictionary * dic = [[NSDictionary alloc] initWithObjectsAndKeys:@"one",@"1",@"two",@"2",@"...
阅读全文
摘要:1.NSRange1 typedef struct _NSRange { 2 NSUInteger location; 3 NSUInteger length; 4 } NSRange;location 位置length 长度2.NSPoint / CGPoint1 struct CGPoint...
阅读全文
摘要:1.基本数据类型与字符串的相互转换 1.1基本数据类型转换到NSString 1 // 1 int -> 转换成NSString 2 // 5 @"5" 3 int age = 18; 4 NSString * str = [[...
阅读全文
摘要:1.创建字符串 1 // 1 直接创建字符串 2 NSString * str = @"abc"; 3 4 // NSString * stra = [[NSString alloc] initWithString:@"def"]; 5 ...
阅读全文