UICollectionView implementieren und benutzerdefinierte Sammlung Ansicht Zelle erstellen, die 6-Etikett in einer Art und Weise enthält ---
1 2 3
4 5 6
Set Anzahl der Elemente in der Sammlung Ansicht: -
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return array.count;
}
Legen Sie die Anzahl der Sektionen: -
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
Set Layoutgröße bei Index p ath nach Ihrer Anforderung
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
// set size of collection view cell (width, height)
return CGSizeMake((self.view.frame.size.width)-40, 200);
}
Sammlung Ansicht Daten ai anderen Index Pfad. Machen IBOutlet von Etiketten in CustomCollectionViewCell Klasse und verbinden in Storyboard: -
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CustomCollectionViewCell* customCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"waitingRoomTipId" forIndexPath:indexPath];
// set data as per the requirement
customCell.label1.text = @"Label1";
customCell.label2.text = @"Label2";
customCell.label3.text = @"Label3";
customCell.label4.text = @"Label4";
customCell.label5.text = @"Label5";
customCell.label6.text = @"Label6";
return customCell;
}
Dies ist, wie sechs Etiketten werden in jeder Zelle angezeigt werden.
Hoffnung diese Lösung wird Ihnen helfen .. Danke
Ich denke, Sie müssen ein anderes benutzerdefiniertes Layout verwenden. Flow-Layout funktioniert auf diese Weise, denke ich. –