2013-08-21 69 views
-2

如何將我的NSDictionary作爲參數發送給我的選擇器,以及如何讀取它?發送NSDictionary作爲@selector中的參數

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); 
} 
+0

看來你沒看過的文檔,或者至少你沒看仔細足夠了... – 2013-08-21 20:25:46

回答

0

updateViewStatistic:方法更改爲這樣的事情:

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

確切同樣的答案發布到副本,因爲它已經說明 - 沒有必要重現它。 – 2013-08-21 20:28:22