我正在使用NSThread
前:
NSThread *driverThread = [[NSThread alloc] initWithTarget:self selector:@selector(**pingHomeThread**) object:nil];
[driverThread start];
in AppDelegate.m i want to execute **pingHomeThread** function in another view like myExample.m as
-(void) pingHomeThread{
}
我该如何实现这个?
答案 0 :(得分:0)
只是改变目标(我不知道你希望你的**在那里,但他们不应该),即改变
NSThread *driverThread = [[NSThread alloc] initWithTarget:self selector:@selector(pingHomeThread) object:nil];
到
NSThread *driverThread = [[NSThread alloc] initWithTarget:yourOtherView selector:@selector(pingHomeThread) object:nil];