头文件:
@interface ClassName : ClassFather <protocol>
UIWindow *window
IBOutlet UILabel *lbl_;
@end
声明属性,也是赋值
@property (nanatomic, retain) IBOutlet UIWindow *window;
函数的声明:
IBAction:表示一个方法,与界面有关联
-(IBAction)click:(id)sender;
protocol
接口、函数,需要遵循协议来运行函数
lbl_ 插座变量
IBOutlet 关键字,interface build中的一个控件
[self.window makeKeyAndVisible];
self.window 取值
方法类型 (返回值)方法签名关键字:(参数类型) 方法签名关键字:(参数类型)参数名称
-(void)insertObject: (id)anObject atIndex:(NSUInteger)index
-对象方法
+类方法
方法的调用:
float fontSize = [(UISlider *)sender value];
sender调用在[]里,既是发送消息的方式。向sender对象发送了一个value的消息。返回值是float。没有参数.
方法声明: - value …
lbl_.font = [UIFont systemFontOfSize:fontSize];
UIFont类调用方法systemFontOfSize类方法,返回值类型UIFont,一个参数
方法声明:+(UIFont *)systemFontOfSize:(CGFloat)fontSize;
#ifndef IBOutlet
#define IBOutlet
#endif
#ifndef IBAction
#define IBAction void
#endif
常用类 NSArray
NSDictionary
NSString
NSNumber