How to put a delegate method into a new thread?
I have implement the delegate method:
-(void)str开发者_JAVA技巧eam:(NSStream*)stream handleEvent:(NSStreamEvent)eventCode;
and for every one second this method will be called,and this method will do many things,so I need to put this method into a new thread,so that the UI thread won't be blocked. and I also want to know what the above delegate method is called by ?system?
A simple way to perform a task in a background thread (note: you can't touch the UI in this thread! You must schedule calls to update the UI on the main thread) is:
[self performSelectorInBackground:@selector(doInBackground) withObject:nil]
精彩评论