摘要:
一、loadView1.什么时候被调用?每次访问UIViewController的view(比如controller.view、self.view)而且view为nil,loadView方法就会被调用。2.有什么作用?loadView方法是用来负责创建UIViewController的view3.默... 阅读全文
摘要:
比如下面张图片,本来是设计来做按钮背景的:button.png,尺寸为:24x60现在我们把它用作为按钮背景,按钮尺寸是150x50: 1 - (void)viewDidLoad 2 { 3 [super viewDidLoad]; 4 // 得到view的尺寸 5 CGSi... 阅读全文
摘要:
一、什么是空指针和野指针1.空指针1> 没有存储任何内存地址的指针就称为空指针(NULL指针)2> 空指针就是被赋值为0的指针,在没有被具体初始化之前,其值为0。下面两个都是空指针:1 Student *s1 = NULL;2 3 Student *s2 = nil;2.野指针"野指针"不是NULL... 阅读全文
摘要:
OC中的self既可以用在动态方法中,也可以用在静态方法中1.self在动态方法中 1 @implementation Student 2 3 - (void)test2 { 4 5 } 6 7 - (void)test3 { 8 [self test2]; 9 }10 11 @end... 阅读全文
摘要:
1.Student.h1 #import 2 3 @interface Student : NSObject {4 int _age;5 }6 - (void)setAge:(int)age;7 - (int)age;8 @end2.Student.m 1 #import "Student.... 阅读全文