如何使用NSOperationQueue

来源:互联网 发布:装修报价软件 编辑:程序博客网 时间:2024/06/09 20:14

[1].[代码] 跳至 [1]

?
1
2
3
4
5
6
7
8
9
10
11
12
13
@interface PersonTableViewController : UITableViewController <AddPerson> {
    NSOperationQueue *queue;
}
@end
 
@implementation PersonTableViewController
 
- (void)addPerson:(NSString *)username {
    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(addPersonInBackground:) object:username];
    [queue addOperation:operation];
    [operation release];
}
@end
0 0