我的视图中有很多不同的控制器,我有一些像以下代码创建的pickerview:
UIPickerView *picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 243, 320, 216)];
switch (sender.tag){
case 0:
picker.tag = 0;
break;
case 1:
picker.tag = 1;
break;
case 2:
picker.tag = 2;
break;
case 3:
picker.tag = 3;
break;
}
picker.delegate=self;
picker.dataSource = self;
picker.showsSelectionIndicator = YES;
[self.view addSubview:picker];
现在我需要使用默认设置(viewdidload
)。我怎么能用标签做到这一点?
答案 0 :(得分:0)
UIPickerView *picker = [self.view viewWithTag:X];
[picker adjustIt];