在 -(void)viewDidLoad
中有没有办法让我的选择器以某个值启动。例如,如果我有一个显示的选择器:
1 , 2 , 3 , 4 , 5
我可以让它在 3 上启动吗?这有意义吗?谢谢
最佳答案
你可以使用这个实例方法:
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;
在您的情况下,它将是这样的:
- (void)viewDidLoad {
[super viewDidLoad];
[myPickerView selectRow:3 inComponent:0 animated:NO];
}
关于ios - 将选择器 View 设置为加载时的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17268836/