一.NSMutableDictionary?
NSMutableDictionary? * tags;
1.NSMutableDictionary 添加內容:
[tags setValue:xxx forKey :xxx];
2.NSMutableDictionary 遍歷:
for(NSString * title in tags){
?? //其中得到的title是key
}
3.NSMutableDictionary 根據key取得value:
[tags valueForKey :xxx];
二.NSMutableArray
NSMutableArray *buttons;
1.NSMutableArray添加內容:
[buttons addObject:xxx];
2.NSMutableArray遍歷:
for(xxxx *button in buttons){
}
三.動態添加按鈕到view以及添加按鈕點擊事件:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
CGRect frame = CGRectMake(0,0,300,20);
[button setFrame:frame];
[button setTitle:@"xxx" forState:UIControlStateNormal];
[button addTarget:self action:@selector(xxxx) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];