对象具备多种形态就是多态; 没有继承就没有多态; 父类指针指向子类对象;Animal *a = [Dog new]; [a eat]; 调用方法是会检测对象的真是形象; NSObject *n = [Dog new]; NSObject *n = [Animal new]; OC是弱语法;runti ...
分类:
其他好文 时间:
2016-04-08 21:45:44
阅读次数:
211
@“456454512213545”也是一个对象; NSString是继承NSObject的;OC的字符串用%@作为占位符; NSString *str = @"itcast";NSLog(@"我在%@上课",str); NSString的类方法:NS[NSString stringWithForm ...
分类:
其他好文 时间:
2016-04-08 21:45:15
阅读次数:
187
id类型 id已经是关键字,以后定义变量要注意; id是万能指针;能指向、操作任何OC对象,没有*,因为它已经包含了*; Person *p = [Person new];可以用下面的来代替,只适用于OC对象; id d = [Person new]; id 你可以认为是NSObject * 因为N ...
分类:
其他好文 时间:
2016-04-08 21:42:14
阅读次数:
245
class HttpRequest: NSObject{ override init() { super.init() } class func parseJSONData(data: AnyObject?) ->NSArray?{ do{ let downloadData=data as? NSD ...
分类:
Web程序 时间:
2016-04-07 20:25:04
阅读次数:
230
NSOperation、NSOperationQueue NSOperation 和 NSOperationQueue 配合使用也能实现多线程。 NSOperation 继承于 NSObject,是一种抽象类,并不具备封装操作的能力,必须使用它的子类。 使用 NSOperation 子类的三种方式: ...
分类:
其他好文 时间:
2016-04-06 15:18:12
阅读次数:
210
0:做内购需要添加系统框架storeKit.frameWork 1:登陆苹果开发者账号中去创建商品,即告诉苹果商场自己都卖哪些东西如图: @interface ProductModel : NSObject /**产品名称*/ @property (nonatomic, copy) NSString ...
分类:
移动开发 时间:
2016-04-05 23:04:12
阅读次数:
1088
恢复内容开始 NS_ASSUME_NONNULL_BEGIN /**************** Notifications ****************/ // 通知,被发送,被接受。 @interface NSNotification : NSObject <NSCopying, NSCod ...
分类:
其他好文 时间:
2016-04-03 23:42:22
阅读次数:
350
IOS中对图片的处理 UIImage UIImage 继承于NSObject 以下介绍一下UIImage中的方法 首先是我们最经常使用的 通过图片的文件名称来获取这个图片 + (UIImage *)imageNamed:(NSString *)name //要注意的是这种方法适用于已经导入到proj ...
分类:
移动开发 时间:
2016-04-01 20:28:28
阅读次数:
233
KVC的使用1: 以Person为例: @interface Person : NSObject @property (nonatomic, copy) NSString *name; @end 属性的方法: Person *person = [[Person alloc] init]; perso ...
分类:
其他好文 时间:
2016-04-01 20:25:21
阅读次数:
135
转载自原文:http://www.tuicool.com/articles/qmMjQnJ 包括以下几类: // 继承自 NSObject:(暂列为控件) UIColor *_color; // 颜色 UIImage *_image; // 图像 // 继承自 UIView: 只能相应手势 UIGe ...
分类:
移动开发 时间:
2016-03-31 14:37:28
阅读次数:
184