2013年5月10日

When to use Delegation, Notification, or Observation in iOS

摘要: A common problem that we often experience when developing iOS applications, is how to allow communication between our controllers, without the need to have excessive coupling. Three common patterns that appear time and time again throughout iOS applications include:DelegationNotification Center, and 阅读全文

posted @ 2013-05-10 14:22 残月下章台 阅读(191) 评论(0) 推荐(0)

iOS运行回路(RunLoop)总结

摘要: 首先看两个runloop的示例,来源:http://paste.lisp.org/display/86524第一个:#includestaticvoid_perform(void*info__unused){printf("hello\n");}staticvoid_timer(CFRunLoopTimerReftimer__unused,void*info){CFRunLoopSourceSignal(info);}intmain(){CFRunLoopSourceRefsource;CFRunLoopSourceContextsource_context;CFRunLo 阅读全文

posted @ 2013-05-10 14:08 残月下章台 阅读(222) 评论(0) 推荐(0)

iOS 深拷贝和浅拷贝

摘要: ios提供了copy和mutablecopy方法,顾名思义,copy就是复制了一个imutable的对象,而mutablecopy就是复制了一个mutable的对象。以下将举几个例子来说明。1、系统的非容器类对象:这里指的是NSString、NSNumber等等一类的对象。NSString *string = @"origion";NSString *stringCopy = [string copy];NSMutableString *stringMCopy = [string mutableCopy];[stringMCopy appendString:@"! 阅读全文

posted @ 2013-05-10 14:03 残月下章台 阅读(165) 评论(0) 推荐(0)

导航