我正在使用自定义布局来使用 UICollectionReusableView 的子类获取多个背景颜色部分。这是代码:
- (void)prepareLayout
{
[super prepareLayout];
self.itemAttributes = [NSMutableArray new];
NSInteger numberOfSection = self.collectionView.numberOfSections;
for (int section = 0; section < numberOfSection; section++) {
if (section == self.decorationViewOfKinds.count)
break;
NSString *decorationViewOfKind = self.decorationViewOfKinds[section % self.decorationViewOfKinds.count];
if ([decorationViewOfKind isKindOfClass:[NSNull class]])
continue;
NSInteger lastIndex = [self.collectionView numberOfItemsInSection:section] - 1;
if (lastIndex < 0)
continue;
UICollectionViewLayoutAttributes *firstItem = [self layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section]];
UICollectionViewLayoutAttributes *lastItem = [self layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:lastIndex inSection:section]];
CGRect frame = CGRectUnion(firstItem.frame, lastItem.frame);
frame.origin.x -= self.sectionInset.top;
frame.size.height += self.sectionInset.bottom;
if …
Run Code Online (Sandbox Code Playgroud) 我主要使用Xcode 9和Objectice-C.调试栏中的可视内存调试按钮按钮不会显示在该方案的任何可能配置中.我也尝试将部署目标升级到iOS10而没有任何运气.
我错过了一些构建设置,因为这个项目是很久以前创建的(我总是更新到每个新版本中的Xcode推荐设置)?
谢谢!