将NSDictionary作为参数发送到@selector

时间:2013-08-21 20:22:51

标签: ios objective-c dictionary selector nsthread

如何在选择器上发送我的NSDictionary作为参数,以及如何阅读它?

NSDictionary * dict = [[NSDictionary alloc]initWithObjectsAndKeys:@"idOferta",@"test", nil];                
NSThread * viewsThread = [[NSThread alloc] initWithTarget:self selector:@selector(updateViewStatistic:) object:dict];
[viewsThread start];

- (void)updateViewStatistic:(NSThread *)mt {
      NSLog(@"dictionary %@",dict); 
}

1 个答案:

答案 0 :(得分:0)

updateViewStatistic:方法更改为以下内容:

- (void)updateViewStatistic:(NSDictionary *)dictionary
{
    NSLog(@"Dictionary: %@", dictionary);
}