开发者

How to Loop NSThread?

开发者 https://www.devze.com 2023-01-03 11:34 出处:网络
I am curious to know if you can loop an NSThread for the iphone sdk. I have learned that instead of using NSTime开发者_JS百科rs which do run off of the main UI, I can use NSThreads to run actions in t

I am curious to know if you can loop an NSThread for the iphone sdk. I have learned that instead of using NSTime开发者_JS百科rs which do run off of the main UI, I can use NSThreads to run actions in the background. Most of my NSTimers have the "repeats:" to YES, thus I need to know if NSThreads can be looped.

Thanks Kevin


- (void) loop {
    while (!finished) { … };
}

- (void) startThreadedLoop {
    finished = NO;
    [self performSelectorInBackground:@selector(loop)];
}
0

精彩评论

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