如何从NSInvocationOperation中调用对象调用方法?

时间:2014-06-08 08:19:53

标签: ios nsinvocationoperation

我已在我的项目中编写代码

[NSInvocationOperation alloc]
                                        initWithTarget:self
                                        selector:@selector(loadImage)
                                        object:ob
方法

中的

- (void)loadImage {

}

1 个答案:

答案 0 :(得分:1)

这可能会有所帮助;

// Your NSInvocationOperation definition 
[NSInvocationOperation alloc] initWithTarget:self selector:@selector(loadImage:) object:ob]; 

// Add an argument, this one is called 'sender'
- (void)loadImage:(id)sender { // 'sender' equals your object 'ob' from above
    // Do whatever you want to
}

有关NSInvocationOperation的更多参考/信息: NSInvocationOperation Class Reference