如何从NSInvocationOperation被调用的方法中获取对象



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

[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类引用

最新更新