随笔分类 - IOS开发
摘要:Note in particular that run loops retain their timers, so you can release a timer after you have added it to a run loop.scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:the target object is retained by the timer and released when the timer is invalidated.invalidateStops the receiver f
阅读全文
摘要:Demo:参考ASIHttpRequest的示例例如:PerformanceTest#import <Foundation/Foundation.h>#import "ASITestCase.h"@interface PerformanceTests : ASITestCase { NSURL *testURL; NSDate *testStartDate; int requestsComplete; NSMutableArray *responseData; unsigned long bytesDownloaded;}- (void)testASIHTTPR
阅读全文
摘要:nsoperation支持特性:1.支持操作之间的依赖性2.支持一个可选的完成Block(等所有操作完成后执行)3.通过kvo来获取当前的运行状态4.改变操作的优先级5.支持取消操作
阅读全文
摘要:object composition (Decorator pattern) is often a better technique than subclassing for extending class behavior.1.Abstract Factoryprovides an interface for creating families of related or dependent objects without specifying their concrete classes提供接口创建相同或类似的对象,不需要指定其具体的类型iso中主要体现在NSNumber和NSArray和
阅读全文
摘要:1 NSString * result;2 NSArray * paths;3 4 result = nil;5 paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);6 if ( (paths != nil) && ([paths count] != 0) ) {7 assert([[paths objectAtIndex:0] isKindOfClass:[NSString class]]);8 result = [paths objectAtIn...
阅读全文
摘要://暂停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 ...
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:passthroughViews属性可以添加多个view,点击时将触摸事件分发下去popoverController.passthroughViews=[NSArrayarrayWithObjects:self.view, nil];
阅读全文
摘要:编辑器加载中...NSArray *visiblePaths = [self.tableView indexPathsForVisibleRows];
阅读全文
摘要:scroll view 原理在滚动过程当中,其实是在修改原点坐标当手指触摸后, scroll view会暂时拦截触摸事件,使用一个计时器,假如在计时器到点后,没有发生手指移动事件,那么,scroll view发送tracking events到被点击的subview假如在计时器到点前,发生了移动事件,那么 scroll view 取消tracking自己发生滚动子类可以重载touchesShouldBegin:withEvent:inContentView: 决定自己是否接收touch事件pagingEnabled当值是YES,会自动滚动到subview的边界,默认是NOtouchesShou
阅读全文

浙公网安备 33010602011771号