-1

我正在编写一个用于解析 xml 文件的程序我需要不断读取该文件,这意味着如果 xml 文件在运行时发生任何更改,它也必须在模拟器中显示我也尝试过

 NSThread *myThread =[[NSThread alloc]initWithTarget:self selector:@selector(doParsing) object:nil];
    [myThread start];

它调用了 xml 文件,但没有显示更改。我怎样才能做到这一点

4

1 回答 1

2

可能是这样的:

NSThread *myThread =[[NSThread alloc]initWithTarget:self selector:@selector(callTimer) object:nil];
[myThread start];

- (void)callTimer
{
   [NSTimer scheduledTimerWithTimeInterval:10.0
    target:self
    selector:@selector(doParsing)
    userInfo:nil
    repeats:YES];
}

- (void)doParsing
{
   //Do the stuff here
}
于 2013-03-18T06:22:04.937 回答