UICollectionview leer ist

Hallo ich habe eine erstellt UIViewController dass ich Hinzugefügt eine UICollectionView mit CustomCell. Dann habe ich eine uicollectionviewcell Klasse für die Zelle. Schließlich setzen Sie den delegate und datasource im storybord selbst. Aber es zeigt eine leere Seite. wie im unteren Bild

UICollectionview leer ist

CODE:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.collectionview = _collectionview;
    self.collectionview.dataSource = self;
    self.collectionview.delegate = self;

    speakersImages=[[NSMutableArray alloc]init];
    //Do any additional setup after loading the view, typically from a nib.
    imageLabels=[[NSMutableArray alloc]initWithObjects:@"RB Forum 2013",@"Agenda",@"Speakers",@"Contact",@"Map",@"Websites",@"@Responsible Biz",@"Partners",@"Sustainability",nil];


    imagePaths=[[NSMutableArray alloc]initWithObjects:[UIImage imageNamed:@"RBform.png"],[UIImage imageNamed:@"agenda.png"],[UIImage imageNamed:@"speakers.png"],[UIImage imageNamed:@"contact.png"],[UIImage imageNamed:@"map.png"],[UIImage imageNamed:@"website.png"],[UIImage imageNamed:@"twitter.png"],[UIImage imageNamed:@"partners.png"],[UIImage imageNamed:@"sustainability.png"], nil];
    [self.collectionview registerClass:[NewCell class] forCellWithReuseIdentifier:@"Cell"];



}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView
     numberOfItemsInSection:(NSInteger)section
{
    return [imageLabels count];
}

//THE BELOW DELEGATE METHOD DOES NOT GET CALLED!


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    //Dispose of any resources that can be recreated.
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    //we're going to use a custom UICollectionViewCell, which will hold an image and its label
    //
    static NSString *CellIdentifier = @"Cell";
    NewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];

    //make the cell's title the actual NSIndexPath value

    cell.labels.text = [NSString stringWithFormat:@"%@",[imageLabels objectAtIndex:indexPath.row]];
    //load the image for this cell
    NSLog(@"%@",imageLabels);
    //NSString *imageToLoad = [NSString stringWithFormat:@"%d.JPG", indexPath.row];
    //   cell.image.image = [UIImage imageNamed:imageToLoad];
    cell.images.image = [imagePaths objectAtIndex:indexPath.row];

    return cell;

}

UICollectionview leer ist

UICollectionview leer ist

UICollectionview leer ist

UICollectionview leer ist

  • Ihre NewCell ist custom class?
  • JA Deepak seine meine custome-Klasse
  • Sind die datasource-Methoden aufgerufen wird?
  • bedeutet? nicht bekomme ich Sie?
InformationsquelleAutor Navi | 2013-11-07
Schreibe einen Kommentar