PGPickerView
PGPickerView copied to clipboard
视图的高度与滚动有关系吗
pickerview的高度与底部视图的高度一样活着小的话 会多出一行。出现数组越界
贴一下代码,我看下
![image](https://user-images.githubusercontent.com/12879534/46999378-18e83b00-d158-11e8-8a2d-aa8c7b14cb7f.png)
![image](https://user-images.githubusercontent.com/12879534/46999402-2c93a180-d158-11e8-8127-346f89d8671c.png)
高度好像只要设置低于50 出现滚动在最后一行还可以向上滚动,界面卡到中间
能弄个demo,我看看吗?
+1
+1 @deanli08
高度好像只要设置低于50 出现滚动在最后一行还可以向上滚动越界 ,界面卡到中间 然后设置初始化滚动好像无效?
我似乎也是这个问题 越界crash了 请问解决了吗?
-
(void)setupTableViewScroll:(UITableView *)tableView animated:(BOOL)animated { CGPoint offsetPoint = CGPointMake(tableView.contentOffset.x, tableView.contentOffset.y + self.rowHeight / 2); NSIndexPath *indexPath = [tableView indexPathForRowAtPoint: offsetPoint]; if (indexPath.row >= self.datas.count) { indexPath = [NSIndexPath indexPathForRow:self.datas.count - 1 inSection:indexPath.section]; } [tableView scrollToRowAtIndexPath: indexPath atScrollPosition: UITableViewScrollPositionTop animated:animated]; }
-
(NSInteger)setupSelectedRow { NSInteger row = self.centerTableView.contentOffset.y / self.rowHeight + 0.5; if (self.isCycleScroll) { CGFloat posY = self.centerTableView.contentOffset.y + self.copyOffsetCount * self.rowHeight + self.rowHeight / 2; NSInteger count = posY / (self.datas.count * self.rowHeight); CGFloat newPosY = (self.centerTableView.contentOffset.y + self.copyOffsetCount * self.rowHeight) - (self.datas.count * self.rowHeight) * count; if (newPosY < 0) { newPosY = 0; } row = newPosY / self.rowHeight + 0.5; } if (row >= self.datas.count) { row = self.datas.count - 1; }
return row; } PGPickerColumnView.m 修改这两个方法就行了 希望兄弟迭代下版本
+1 这个问题好像还有