withobject专题

iOS: NSArray的方法makeObjectsPerformSelector:withObject:

- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject 遍历数组,向数组每个元素发送消息(SEL)aSelector, (id)anObject是这个方法的参数。 - (void)makeObjectsPerformSelector:(SEL)aSelector

NSThread的简单使用 及performSelectorInBackground:withObject

NSThread的简单使用 及performSelectorInBackground:withObject 在ios开发过程中,经常会遇到在服务器端获取完数据通过后台使用多线程方式自动更新UI,通常的做法有两种: 1、使用NSObject类的方法performSelectorInBackground:withObject:来创建一个线程。 具体的代码: [Ob

数组之makeObjectsPerformSelector:withObject:

- (void)makeObjectsPerformSelector:(SEL)aSelector;- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)argument; 这是 NSArray和NSSet的两个方法,相信大家很少用,它类似于 for循环,但有效率高于for循环 makeObjects

performSelector:withObject:withObject:]: message sent to deallocated

被这个错误困扰和很长时间,有点莫名其妙,一开始老是从这个消息上检查,以为时事件绑定或者是代码问题,问题其实出现在deallocated上,因为controller被设置为autorelease,view被addsubview到某个container上,所以触发事件的时候,发送message到已经dealloc的controller上,导致上述错误。   其实以前已经发现过这个问题,就是作为全局变