摘要: //暂停layer上面的动画- (void)pauseLayer:(CALayer*)layer{ CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil]; layer.speed = 0.0; layer.timeOffset = pausedTime;}//继续layer上面的动画- (void)resumeLayer:(CALayer*)layer{ CFTimeInterval pausedTime = [layer timeOffset]; layer.speed ... 阅读全文
posted @ 2012-03-27 17:11 Kalou 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-03-27 10:52 Kalou 阅读(127) 评论(0) 推荐(0) 编辑
摘要: - (NSString *)getCurrentDate{ NSDateFormatter *formatter =[[[NSDateFormatteralloc] init] autorelease]; NSDate *date = [NSDate date]; [formatter setTimeStyle:NSDateFormatterMediumStyle]; NSCalendar *calendar = [[[NSCalendaralloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; ... 阅读全文
posted @ 2012-03-13 17:15 Kalou 阅读(874) 评论(0) 推荐(0) 编辑
摘要: from CFRunLoop ReferenceCFRunLoop monitors sources of input to a task and dispatches control when they become ready for processing.Examples of input source might include user input devices,network connection,periodic or timed-delay events,and asynchronous callbacks.Three types of objects can be moni 阅读全文
posted @ 2012-03-12 12:28 Kalou 阅读(1065) 评论(0) 推荐(0) 编辑
摘要: Creating an HTTP request with CFHTTP requires four steps:Generate a CFHTTP message object using theCFHTTPMessageCreateRequestfunction.Set the body of the message using the functionCFHTTPMessageSetBody.Set the message's headers using theCFHTTPMessageSetHeaderFieldValuefunction.Serialize the messa 阅读全文
posted @ 2012-02-20 11:40 Kalou 阅读(523) 评论(0) 推荐(0) 编辑
摘要: Stream是单向的,Reading From Input Streams:1.Create and initilize an instance of NSInputStream from s source of data;2.Sechedule the stream object on a run loop and open the stream;3.Handle the events that the stream object reports to its delegate;4.When there is no data to read,dispose the stream object 阅读全文
posted @ 2012-02-16 12:49 Kalou 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Blocks objects are c-based language feature that you can used in C/C++ or objective-C code.A block is actually represented by an underlying data structure that resembles an object and is created and managed for you by the compiler.The compiler packages up the code you provide (along with any related 阅读全文
posted @ 2012-02-02 13:34 Kalou 阅读(186) 评论(0) 推荐(0) 编辑
摘要: All dispatch queues are first-in,first-out data structures.Types of dispatch queues:serial (as private dispatch queues)concurrent (as global dispatch queue)main dispatch queueAdvantage:The most advantage is the simplicity of the work-queue programming model.Dispatch queues let you focus on the work 阅读全文
posted @ 2012-02-02 11:58 Kalou 阅读(189) 评论(0) 推荐(0) 编辑
摘要: passthroughViews属性可以添加多个view,点击时将触摸事件分发下去popoverController.passthroughViews=[NSArrayarrayWithObjects:self.view, nil]; 阅读全文
posted @ 2011-12-22 17:14 Kalou 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 所有的引用计数系统,都存在循环应用的问题。例如下面的引用关系:对象a创建并引用到了对象b.对象b创建并引用到了对象c.对象c创建并引用到了对象b.这时候b和c的引用计数分别是2和1。当a不再使用b,调用release释放对b的所有权,因为c还引用了b,所以b的引用计数为1,b不会被释放。b不释放,c的引用计数就是1,c也不会被释放。从此,b和c永远留在内存中。这种情况,必须打断循环引用,通过其他规则来维护引用关系。比如,我们常见的delegate往往是assign方式的属性而不是retain方式的属性,赋值不会增加引用计数,就是为了防止delegation两端产生不必要的循环引用。如果一个UI 阅读全文
posted @ 2011-12-20 15:22 Kalou 阅读(948) 评论(0) 推荐(0) 编辑