答案来源https://stackoverflow.com/questions/9069658/uipicker-view-selection-indicator-issue
正常生成pickerView:
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:frame];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator = YES;
[self.view addSubview:pickerView];
可能还会出现没有正常显示选择分割线的问题,解决办法是再加一行代码:
[pickerView selectRow:0 inComponent:0 animated:NO];
也就是手动设置一下默认选中行就可以了
网友评论