在AppDelegate方法里,添加类方法+ (NSInteger)OSVersion;实现为+ (NSInteger)OSVersion{ static NSUInteger _deviceSystemMajorVersion = -1; static dispatch_once_t ...
分类:
移动开发 时间:
2014-08-20 12:12:22
阅读次数:
188
#import @interface Father : NSObject @property (nonatomic,copy) NSString *name;@property (nonatomic,retain) NSNumber *age;-(id) initWithName:(NSString...
分类:
移动开发 时间:
2014-08-19 00:57:13
阅读次数:
316
#import #define CHILD_WEAK_NOTIFC @"childe_week"@interface Child : NSObject@property (nonatomic,assign) int age;@property (nonatomic,assign) NSInteger...
分类:
移动开发 时间:
2014-08-19 00:47:13
阅读次数:
298
类的基本概念
类:具有相同特征和相同行为的事物的抽象
类是一个抽象的概念,在生活中不具体
对象,是类的实例,也就是类的具体体现,是具体的,生活中的万物都是对象
类的接口部分的定义,写在.h文件中
方法声明:
如 - (void)”方法返回类型” say ”方法名” :(NSInteger)”参数类型” x ”参数名” y ”参数名":(NSInteger)”参数类型”...
分类:
其他好文 时间:
2014-08-18 09:16:13
阅读次数:
271
#import @interface Person : NSObject@property(nonatomic,copy) NSString *name;@property(nonatomic,retain) NSNumber *age;-(void) setNewName:(NSString *)...
分类:
移动开发 时间:
2014-08-18 01:30:33
阅读次数:
230
1、首先先了解下NSNumber类型:苹果官方文档地址:https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Referenc...
分类:
移动开发 时间:
2014-08-18 00:08:33
阅读次数:
274
一、NSnumber常见用法NSNumber+ (NSNumber *)numberWithInt:(int)value;+ (NSNumber *)numberWithDouble:(double)value;- (int)intValue;- (double)doubleValue;-(floa...
分类:
移动开发 时间:
2014-08-18 00:06:23
阅读次数:
315
当需要使用int类型的变量的时候,可以像写C的程序一样,用int,也可以用NSInteger,但更推荐使用NSInteger,因为这样就不用考虑设备是32位的还是64位的。可以看如下定义:#if__LP64__||(TARGET_OS_EMBEDDED&&!TARGET_OS_IPHONE)||TA...
分类:
移动开发 时间:
2014-08-17 02:19:51
阅读次数:
232
NSString的使用。1、 - (NSUInteger)length; 返回字符串的长度NSString *demo = @"hello world";NSString *demo two=@"good morning";NSLog(@"%ld", [demo length]);输出为 112- ...
分类:
其他好文 时间:
2014-08-16 18:18:50
阅读次数:
263
NSHTTPCookie在iOS中使用NSHTTPCookie类封装一条cookie,通过NSHTTPCookie的方法读取到cookie的通用属性。- (NSUInteger)version; - (NSString *)name;- (NSString *)value;- (NSString *...
分类:
移动开发 时间:
2014-08-16 12:31:00
阅读次数:
178