WMPageController
WMPageController copied to clipboard
WMProgressView的崩溃问题
- (void)drawRect:(CGRect)rect {
// Drawing code
[super drawRect:rect];
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGFloat height = self.frame.size.height;
int index = (int)self.progress;
index = (index <= self.itemFrames.count - 1) ? index : (int)self.itemFrames.count - 1;
CGFloat rate = self.progress - index;
CGRect currentFrame = [self.itemFrames[index] CGRectValue]; //这里
...
}
CGRect currentFrame = [self.itemFrames[index] CGRectValue];
最后一行在 self.itemFrames
的count
等于0的时候会导致越界。
复现步骤的话大概是启用了progress,然后第一次reloadData有数据,第二次reloadData没有数据就会导致这个问题。
自己处理下吧,我这边都是自己处理的。这个框架内有几处对数组的操作,建议都看下。。
自己处理下吧,我这边都是自己处理的。这个框架内有几处对数组的操作,建议都看下。。
作者弃坑了吗😂
same