-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
bug提交前阅读
1.请先仔细阅读文档,尤其是【其他注意事项】文档,里面有常见问题的解决方案;
2.请先搜索已有的Issues,尝试找到相同问题的讨论;
3.请先阅读相关类的API、源码,尝试从源码找到答案;
4.如果以上步骤都未能解决你的疑问,欢迎提交ISSUE;
bug描述
请简单描述你的bug现象。
版本号
1.JXCategoryView版本号:1.5.7,升级最新后也一样
2.手机系统版本号:18.5
3.手机型号:iPhone13pro
复现步骤
- 遇到问题的相关效果、类是:?
2.具体的操作步骤是:?
截图、GIF
提供bug出现时的截图或者GIF。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Collection view delegate returned a negative size {-1, 36} from -collectionView:layout:sizeForItemAtIndexPath: for item 0 in section 0, which is not supported by flow layout. Delegate: <WTVCategoryTitleImageView: 0x134d28000; frame = (0 0; 335.92 36); layer = <CALayer: 0x134ca3660>>; collection view: <JXCategoryCollectionView: 0x134c38e00; baseClass = UICollectionView; frame = (0 0; 335.92 36); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x134c19950>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x134ca3760>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x134c41180>; dataSource: <WTVCategoryTitleImageView: 0x134d28000; frame = (0 0; 335.92 36); layer = <CALayer: 0x134ca3660>>>'
定位问题位置:
JXCategoryBaseView.m
- (CGSize)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(self.dataSource[indexPath.item].cellWidth, self.collectionView.bounds.size.height);
}
这里的cellWidth存在为-1的情况,这样这个方法就crash啦,建议加个绝对值。