如何将NSthread函数从一个视图传递到另一个视图

时间:2011-10-25 11:50:02

标签: objective-c ios4 iphone-sdk-3.0

我正在使用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{
}

我该如何实现这个?

1 个答案:

答案 0 :(得分:0)

只是改变目标(我不知道你希望你的**在那里,但他们不应该),即改变

NSThread *driverThread = [[NSThread alloc] initWithTarget:self selector:@selector(pingHomeThread) object:nil];

NSThread *driverThread = [[NSThread alloc] initWithTarget:yourOtherView selector:@selector(pingHomeThread) object:nil];