摘要: 12345678910111213//方法一:cell.contentView.backgroundColor = [UIColor redColor];//方法二:UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];UIView* bgview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];bgview.opaque = YES;bgview.backgroundColor = [UIColor orangeC 阅读全文
posted @ 2013-07-07 16:40 cocoajin 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 一:创建 宏 文件SynthesizeSingleton.hSynthesizeSingleton.h#if __has_feature(objc_arc) // ARC Version#define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \\+ (classname *)shared##classname\{\ static classname *shared##classname = nil;\ static dispatch_once_t onceToken;\ dispatch_once(&onceToken, ^{\... 阅读全文
posted @ 2013-07-07 13:08 cocoajin 阅读(526) 评论(0) 推荐(0) 编辑
摘要: iOS 5 中对属性的设置新增了strong 和weak关键字来修饰属性(iOS 5 之前不支持ARC)strong 用来修饰强引用的属性;@property (strong) SomeClass * aObject;对应原来的@property (retain) SomeClass * aObject; 和 @property (copy) SomeClass * aObject;weak 用来修饰弱引用的属性;@property (weak) SomeClass * aObject;对应原来的@property (assign) SomeClass * aObject;__weak, __ 阅读全文
posted @ 2013-07-05 19:58 cocoajin 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 保留一个对象创建了一个对该对象的“强”引用。一个对象只有在它的所有强引用都被释放后才能被回收。因此,一个对象的生命周期取决于其强引用的所有者。在某些情况下,这种行为可能并不理想。您可能想要引用一个对象而不妨碍对象本身的回收。对于这种情况,您可以获取一个“弱”引用。弱引用是通过存储一个指向对象的指针创建的,而不是保留对象。 弱引用在可能会出现循环引用的情况下是必不可少的。例如,如果对象A和对象B互相通信,两者都需要引用对方。如果每个对象都保留对方对象,则这两个对象只有在它们之间的连接中断后才能被回收,但是它们之间的连接又只能在有对象被回收后才能中断。为了打破这种循环,其中一个对象需要扮演从属角. 阅读全文
posted @ 2013-07-05 19:26 cocoajin 阅读(1998) 评论(0) 推荐(0) 编辑
摘要: 1:HTTP协议即超文本传送协议(Hypertext Transfer Protocol ),是Web联网的基础,也是手机联网常用的协议之一,HTTP协议是建立在TCP协议之上的一种应用。HTTP连接最显著的特点是客户端发送的每次请求都需要服务器回送响应,在请求结束后,会主动释放连接。从建立连接到关闭连接的过程称为“一次连接”。2:套接字(socket)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元。它是网络通信过程中端点的抽象表示,包含进行网络通信必须的五种信息:连接使用的协议,本地主机的IP地址,本地进程的协议端口,远地主机的IP地址,远地进程的协议端口。套接字之间的连接过程 阅读全文
posted @ 2013-07-05 19:00 cocoajin 阅读(909) 评论(0) 推荐(0) 编辑
摘要: - (NSDate *)jsDateFromBeginDate:(NSDate *)beginDate todays:(int)days{ NSDate *dateTemp = [[NSDate alloc]init]; NSTimeInterval interval = 24*60*60*days; dateTemp = [dateTemp initWithTimeInterval:interval sinceDate:beginDate]; return dateTemp;} NSDateFormatter * dateFormatter= [[[NSDa... 阅读全文
posted @ 2013-06-25 19:36 cocoajin 阅读(3322) 评论(0) 推荐(0) 编辑
摘要: 方法一: 可以用nsdate 的 timeIntervalSince1970 方法把时间转换成时间戳进行比较,这里timeIntervalSince1970返回的是NSTimeInterval(double)类型,直接比较就可以了方法二:使用nsdate的compare方法实现- (BOOL)date:(NSDate*)date isBetweenDate:(NSDate*)beginDate andDate:(NSDate*)endDate{ if ([date compare:beginDate] == NSOrderedAscending) return NO; ... 阅读全文
posted @ 2013-06-24 17:38 cocoajin 阅读(657) 评论(0) 推荐(0) 编辑
摘要: iPhone-only AppsInclude the following in your application's Resources group in the Xcode project:Table 1iPhone-only apps icon requirements.Image Size (px)File NameUsed ForRequired Status512x512iTunesArtworkAd Hoc iTunesOptional but recommended57x57Icon.pngApp Store and Home screen on iPhone/iPod 阅读全文
posted @ 2013-06-21 13:08 cocoajin 阅读(563) 评论(0) 推荐(0) 编辑
摘要: 在icon默认情况: 程序的图标会被apple进行美化, 自动圆角, 加上阴影和反光效果;如果不想要这种效果:在Info.plist中添加一个Icon already includes gloss effects并选择YES. 阅读全文
posted @ 2013-06-21 12:36 cocoajin 阅读(414) 评论(0) 推荐(0) 编辑
摘要: Advantages:Makes setFrame ofUIPickerViewbehave like it shouldNo transform code within yourUIViewControllerWorks withinviewWillLayoutSubviewsto rescale/position theUIPickerViewWorks on the iPad withoutUIPopoverThe superclass always receives a valid heightWorks with iOS 5Disadvantages:Requires you to 阅读全文
posted @ 2013-06-20 19:02 cocoajin 阅读(3242) 评论(0) 推荐(0) 编辑