WMPageController icon indicating copy to clipboard operation
WMPageController copied to clipboard

WMProgressView的崩溃问题

Open sunsx9316 opened this issue 6 years ago • 3 comments

- (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.itemFramescount等于0的时候会导致越界。

复现步骤的话大概是启用了progress,然后第一次reloadData有数据,第二次reloadData没有数据就会导致这个问题。

sunsx9316 avatar Feb 25 '19 02:02 sunsx9316

自己处理下吧,我这边都是自己处理的。这个框架内有几处对数组的操作,建议都看下。。

onntztzf avatar Mar 04 '19 16:03 onntztzf

自己处理下吧,我这边都是自己处理的。这个框架内有几处对数组的操作,建议都看下。。

作者弃坑了吗😂

sunsx9316 avatar Mar 05 '19 15:03 sunsx9316

same

Yongle-Fu avatar Aug 26 '19 03:08 Yongle-Fu