UIPickerView如何滚动到指定的行
时间:2018-08-27 20:42:23
收藏:0
阅读:794
我打算让控件一开始就选中某个日期,我使用了下面的方法。
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated
按照我自己的理解,此时应该会去执行代理方法:
- pickerView:didSelectRow:inComponent:
,然而实际运行时发现,代理方法并没有触发,结果我在设置了滚动到的位置后,必须主动调用代理方法。也就是下面这样:[self.picker selectRow:0 inComponent:0 animated:YES]; [self pickerView:self.picker didSelectRow:0 inComponent:0];
原文:https://www.cnblogs.com/Michael-hy/p/9543982.html
评论(0)