开发者

How to put a delegate method into a new thread?

开发者 https://www.devze.com 2023-04-06 10:04 出处:网络
I have implement the delegate method: -(void)str开发者_JAVA技巧eam:(NSStream*)stream handleEvent:(NSStreamEvent)eventCode;

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消