當我開始滾動時,我有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