objective c - How to create UICollectionView with alternating cell amount layout? -
i developing ipad app uses uicollectionview display list of products company. cells layout want utilize alternating between rows 1 image , 2 images, first row 1 image, sec row 2 images, 3rd row 1 image... , on, can't figure out how in code.
so can help me one?
hey guys manage working code:
- (nsinteger)collectionview:(uicollectionview *)view numberofitemsinsection:(nsinteger)section { homecoming 2; } - (nsinteger)numberofsectionsincollectionview: (uicollectionview *)collectionview { homecoming 30; } - (uicollectionviewcell *)collectionview:(uicollectionview *)cv cellforitematindexpath:(nsindexpath *)indexpath { cells *cell; if (indexpath.row %2) { nslog(@"%li", indexpath.row); cell = [cv dequeuereusablecellwithreuseidentifier:@"one" forindexpath:indexpath]; cell.label.text = @"one"; cell.backgroundcolor = [uicolor bluecolor]; homecoming cell; } else { nslog(@"%li", indexpath.row); cell = [cv dequeuereusablecellwithreuseidentifier:@"two" forindexpath:indexpath]; cell.labela.text = @"two"; cell.labelb.text = @"two"; cell.backgroundcolor = [uicolor redcolor]; homecoming cell; } }
objective-c ios7 uicollectionview uicollectionviewcell
No comments:
Post a Comment