Objective -c Content
1、面向对象(OOP)和面向过程、类(Class)和对象(Object)、类的定义
2、创建对象、self和super关键字、属性以及点语法(nonatomic,assign、retain、copy 、readonly、readwrite)
3、便利构造器、单例(Singleton)
4、堆栈、内存管理(alloc、copy、retain,release、autorelease、strong、weak)
5、键值编码(KVC)、键值监听(KVO)、通知中心(NSNotificationCenter)、通知 (NSNotification)
6、类目(Category)、延展(Extention)、协议(protocol)
1.message:OC允许开发者在运行时动态的创建新的方法和消息。
2.interface,method define
#import <Foundation/Foundation.h> //#import 预处理指命,可以确保同一资源被包含的次数为1次;
@interface Myclass :NSObject
{
BOOL isPower;
@private float speed;
}
+(id)alloc; //id 通用数据类型,可以用来引用任意类型对象;类方法;
-(BOOL)powerOn; 实例方法;
@end
3. @implementation //在.m文件中;
4.setter,getter//@property(coyy) int size; @synthesize size; 属性被.逶明的调用myclass.size=3;
5.@protocol//是一组商定的方法;
@protocol MyclassDelegate
-(void)reverStr:(NSString *) str;
@required
-(void)splictStr:(NSString *)str;
@end
@interface Myclass:NSObject
{
id delegete;
}
@property(assign) id<MyclassDelegate> delegate;
@end
6.category// file name: Myclass+reverse ,interface name: Myclass (reverse) 在没有源代码的情况下,给基类添加方法;
7.pose //一个子类可以替位成为其基类之一;
8.cocoa资源 http://developer.apple.com/reference/cocoa/