`
tomgooityeeee
  • 浏览: 71887 次
文章分类
社区版块
存档分类
最新评论

线程循环

阅读更多

    @selector(xxxThread)方法以后,在方法中添加
-(void)xxxThread
{
    NSAutoreleasePool* pool = [NSAutoreleasePool new];
    NSRunLoop* loop = [NSRunLoop currentRunLoop];

    NSTimer* timer = [[NSTimer alloc] initWithFireDate:nil
                                              interval:yourtime
                                                target:self 
                                              selector:@selector(yourFun:) 
                                              userInfo:nil
                                               repeats:YES];
    [loop addTimer:timer forMode:NSDefaultRunLoopMode];
    
    while([loop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);

    [pool release];
} 

 
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics