Skip to content
Dexter edited this page Nov 24, 2017 · 2 revisions

All Chart Support Scroll

XChartView is UIScrollView SubClass.

According to the item count and each item size, set the contentsize. :>

//计算是否需要滚动
- (CGSize)computeSrollViewCententSizeFromItemArray:(NSMutableArray<XBarItem *> *)itemArray {
    
    if (itemArray.count <= 8) {
        self.needScroll = NO;
        return CGSizeMake(self.frame.size.width, self.frame.size.height);
    } else {
        self.needScroll = YES;
        CGFloat width = PartWidth * itemArray.count;
        CGFloat height = self.frame.size.height;
        return CGSizeMake(width, height);
    }
    
}
Clone this wiki locally