WenchaoD / FSCalendar

A fully customizable iOS calendar library, compatible with Objective-C and Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS 15.2 Xcode13.2 报错 [UICollectionViewRecursion] <FSCalendarCollectionView: 0x7ff4f3306c00; baseClass = UICollectionView; frame = (0 0; 414 738); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x6000002af810>; layer = <CALayer: 0x600000cc7e00>; contentOffset: {0, 0}; contentSize: {414, 4446}; adjustedContentInset: {0, 0, 0, 0}; layout: <FSCalendarCollectionViewLayout: 0x7ff4f7f1fd80>; dataSource: <FSCalendar: 0x7ff4f7f05ef0; frame = (0 36; 414 738); layer = <CALayer: 0x600000ca1260>>> is stuck in its update/layout loop. See previous logs in the "UICollectionViewRecursion" category to find callers that scheduled a recursive update ;通过测试发现问题出在layout计算item大小的时候出现了宽度问题

GoodLuckBobe opened this issue · comments

The following informations are requested in a bug report

  • A brief bug description.
  • Stack trace.
  • Integration method.(manually/cocoapods/carthage)
  • Full steps to reproduce.
  • Device modal and iOS version. e.g. iPhone 6s iOS9.1
  • Xcode version. e.g. Xcode 8.1
  • FSCalendar version. e.g. FSCalenda 2.5.1
  • Does this happen in the demo project? Which one? Or a link to another demo project.

如果在使用过程中遇到问题,请提供以下信息以便于尽快将问题修复

  • 简单描述一下问题。
  • 控制台输出的堆栈跟踪(如果有的话)。
  • 安装方式. 如手动安装、cocoapods安装、或者通过carthage安装
  • 能够重现此问题的完整步骤。
  • 设备型号及版本。 例如: iPhone6s iOS9.1
  • 使用的Xcode版本。 例如: Xcode8.1
  • FSCalendar版本. 例如: FSCalendar 2.5.1
  • 是否能在demo中重现,以及在哪个demo中重现?或者附加一个重现问题的demo链接。

static inline void FSCalendarSliceCake(CGFloat cake, NSInteger count, CGFloat pieces) {
CGFloat total = cake;
for (int i = 0; i < count; i++) {
NSInteger remains = count - i;
CGFloat piece = FSCalendarRound(total/remains
2)*0.5;
total -= piece;
pieces[i] = piece;
}

/*
 CGFloat total = cake;
 CGFloat itemWidth = floor(total / count);
 for (int i = 0; i < count; i++) {
     pieces[i] = itemWidth;
 }
 */

}
将以上代码修改为注释代码内容后解决了,怀疑CGFloat piece = FSCalendarRound(total/remains*2)*0.5;这个代码在round四舍五入的情况在新的版本中会导致collectionView陷入刷新的死循环中;在其他版本的代码是一直正常运行的;具体原因清楚,目前做了以上修改不再闪退

试了下没有复现。如有额外复现信息请重新打开。
1642321171061