-
Notifications
You must be signed in to change notification settings - Fork 33
isCycleScroll设置为YES情况下崩溃 #17
Copy link
Copy link
Open
Description
前提在isCycleScroll为YES 接着设置第一个程序崩溃,isCycleScroll为NO的情况程序正常执行
[self.pickerView selectRow:0 inComponent:0 animated:true];
报错位置
- (void)selectRow:(NSInteger)row animated:(BOOL)animated {
NSInteger newRow = row;
if (self.isCycleScroll) {
newRow = row - self.copyOffsetCount;
}
if (animated) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:newRow inSection:0];
[self.centerTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:true];
self.selectedRow = row;
self.isSelectedRow = true;
}else {
self.centerTableView.contentOffset = CGPointMake(0, newRow * self.rowHeight);
[self scrollViewDidEndDecelerating: self.centerTableView];
}
}
这行代码导致的错误
newRow = row - self.copyOffsetCount;
设置第一个位置0的时候,newRow值为负数
[NSIndexPath indexPathForRow:newRow inSection:0] 报错
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels