当我开始滚动时,我有UICollectionView与customLayOut, 我改变了应该开始可见的单元格的x坐标 - 以便从开始时可见。如何把UICollectionView中的单元格放在另一个上
-(void)layoutSubviewsWithAttributes:(NSMutableArray *)theAttributes {
CGFloat halfScreen = [UIScreen mainScreen].bounds.size.width/2;
CGPoint startOfScreen = CGPointMake(self.timeLineCollection.bounds.origin.x, 25.f);
for(UICollectionViewLayoutAttributes *attribute in theAttributes) {
if(CGRectContainsPoint(attribute.frame, startOfScreen)) {
NSLog(@"Intersect %@", NSStringFromCGRect(attribute.frame));
attribute.frame = CGRectMake(startOfScreen.x, startOfScreen.y, attribute.frame.size.width, attribute.frame.size.height);
}
}
,但在某些情况下,该小区出现在下一个单元格(错误的行为)的顶部,
另一次,下下一次该小区一个细胞(因为我需要它被放置)。
莫非你的意见,如何排序的细胞进行分级一个放置在另一个(如卡)。
非常感谢您的帮助。
按照本教程:https://www.raywenderlich.com/107687/uicollectionview-custom-layout-tutorial-spinning-wheel – shallowThought
@shallowThought,谢谢你,但我没有看到解决方案,我的问题有 – Melany