Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[12]'
- @property (weak, nonatomic) IBOutlet UILabel *cellLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *cellImages;
- @property (weak, nonatomic) IBOutlet UICollectionView *cView;
- @property (nonatomic, strong) NSArray *themeLabels;
- @property (nonatomic, strong) NSArray *themeImages;
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- self.cView.dataSource = self;
- self.cView.delegate = self;
- self.themeLabels = [[NSArray alloc] initWithObjects:@"Default", @"Peacock", @"Purple", @"Rainbow", @"Multi Zebra", @"Green", @"Marble", @"Prosperity", @"Leopard", @"Circle", @"Slanted", @"Orange", @"Reddish", nil];
- NSLog(@"The themes are %@", self.themeLabels);
- 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"]];
- }
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
- {
- return 1;
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- return [self.themeLabels count];
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- ThemeCell *themeCell = (ThemeCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"Theme Cell" forIndexPath:indexPath];
- NSString *cellData = [self.themeLabels objectAtIndex:indexPath.row];
- themeCell.cellLabel.text = cellData;
- themeCell.cellImages.image = self.themeImages[indexPath.row];
- return themeCell;
- }
- themeCell.cellImages.image = self.themeImages[indexPath.row];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement