Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[12]'
  2.  
  3. @property (weak, nonatomic) IBOutlet UILabel *cellLabel;
  4. @property (weak, nonatomic) IBOutlet UIImageView *cellImages;
  5.  
  6. @property (weak, nonatomic) IBOutlet UICollectionView *cView;
  7. @property (nonatomic, strong) NSArray *themeLabels;
  8. @property (nonatomic, strong) NSArray *themeImages;
  9.  
  10. - (void)viewDidLoad
  11. {
  12. [super viewDidLoad];
  13. self.cView.dataSource = self;
  14. self.cView.delegate = self;
  15. self.themeLabels = [[NSArray alloc] initWithObjects:@"Default", @"Peacock", @"Purple", @"Rainbow", @"Multi Zebra", @"Green", @"Marble", @"Prosperity", @"Leopard", @"Circle", @"Slanted", @"Orange", @"Reddish", nil];
  16. NSLog(@"The themes are %@", self.themeLabels);
  17.  
  18. self.themeImages = @[[UIImage imageNamed:@"Newiphonebackground.png"], [UIImage imageNamed:@"peacock.png"], [UIImage imageNamed:@"Purplepink.png"], [UIImage imageNamed:@"Rainbow.png"], [UIImage imageNamed:@"PinkZebra.png"], [UIImage imageNamed:@"Greenish.png"], [UIImage imageNamed:@"MarblePrint.png"], [UIImage imageNamed:@"Prosperity.png"], [UIImage imageNamed:@"leopard.png"], [UIImage imageNamed:@"CircleEffect.png"], [UIImage imageNamed:@"RedSlanted.png"], [UIImage imageNamed:@"Orange3.png"], [UIImage imageNamed:@"ReddishBack.png"]];
  19. }
  20.  
  21. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
  22. {
  23. return 1;
  24. }
  25.  
  26. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  27. {
  28. return [self.themeLabels count];
  29. }
  30.  
  31. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  32. {
  33. ThemeCell *themeCell = (ThemeCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"Theme Cell" forIndexPath:indexPath];
  34. NSString *cellData = [self.themeLabels objectAtIndex:indexPath.row];
  35. themeCell.cellLabel.text = cellData;
  36. themeCell.cellImages.image = self.themeImages[indexPath.row];
  37. return themeCell;
  38. }
  39.  
  40. themeCell.cellImages.image = self.themeImages[indexPath.row];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement