我已经在项目中编写了代码

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


方法中

- (void)loadImage {

}

最佳答案

这可能会有所帮助;

// 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

关于ios - 如何从NSInvocationOperation调用方法获取对象?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24104272/

10-09 03:02