关于KVC的方法- (void)setValue:(nullable id)value forKey:(NSString *)key;从上面的参数类型可以看出,value必须是一个对象,可以为nil对象.当你的属性是@property (nonatomic, assign) NSInteger te...
分类:
其他好文 时间:
2015-11-29 22:48:58
阅读次数:
1155
//创建时间 NSInteger numTime = [dict[@"createTime"][@"time"] longLongValue]/1000; NSDate *nowTime = [NSDate dateWithTimeIntervalSince1970:numTim...
分类:
移动开发 时间:
2015-11-27 14:33:40
阅读次数:
155
oc中的消息机制:如果为类方法,消息接收者为类名 如果为实例方法,消息接收者为对象名 消息带参数给参数,不带就不给 消息有返回值,定义相同类型的变量接收,没有就不需要定义变量//各实例变量的课件度 NSInteger _height; ...
分类:
其他好文 时间:
2015-11-26 22:49:02
阅读次数:
207
1.@property 后面可以有哪些修饰符?1.读写性: readwrite:可读可写,系统为我们创建这个属性的setter和getter方法readonly:只读,系统只为我们创建一个setter方法2.setter相关:assign:表示直接复制,用于基本数据类型(NSInteger和CGFl...
分类:
移动开发 时间:
2015-11-26 17:04:47
阅读次数:
169
导航:基本数据类型对象类型id类型1.基本数据类型Objective-C中的基本类型与C语言的基本类型一样,主要有:int,long,float,double,char,void,bool等. 值得注意的是,在Foundation框架中,系统为某些数据起了别名,如: NSInteger 是 lon....
分类:
其他好文 时间:
2015-11-25 22:29:44
阅读次数:
157
1.1 十进制转2进制-(NSString *)binaryFromInteger:(NSInteger)index{ NSString *str = @""; while (index != 1) { NSInteger two = index % 2; s...
分类:
其他好文 时间:
2015-11-25 10:59:01
阅读次数:
155
IOS不允许Header和Footer为0但有时为方便写代码还是要有设置为0的时候,那么这时可以设置为0.0001,这样也就显示不出来了-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)s...
分类:
其他好文 时间:
2015-11-25 10:07:06
阅读次数:
114
首先在CatMazeV3中新建CatSprite类,继承于Sprite.其中CatSprite.h文件如下所示:#import "CCSprite.h"@class MainScene;@interface CatSprite : CCSprite@property (nonatomic,assign,readonly) NSInteger numBones;-(id)initWithMainSce...
分类:
其他好文 时间:
2015-11-21 11:54:57
阅读次数:
152
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRe...
分类:
其他好文 时间:
2015-11-21 11:43:43
阅读次数:
118
#import /*** 分数类*/@interface HHFraction : NSObject { NSInteger _num; //分子 NSInteger _den; // 分母}/*** 初始化方法** @param num 分子* @param den 分母** @return...
分类:
其他好文 时间:
2015-11-18 19:42:47
阅读次数:
181