-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
NSString *name;
NSInteger entityIndex = [indexPath row];
@try {
Entity *entity = [[coreDataObject entities] objectAtIndex:entityIndex];
name = [entity name];
}
@catch (NSException *exception) {
NSLog(@"Exception in cellForRowAtIndexPath: %@",[exception reason]);
}
UICollectionViewCell *cell = [[UICollectionViewCell alloc] init];
UIView *contentView = [cell contentView];
// Create the label that will display the given username.
UILabel *label = [[UILabel alloc] init];
[label setText:name];
[label setFont:[UIFont fontWithName:@"Arial" size:60]];
// Put the label in the collection view cell's content view.
[contentView addSubview:label];
// Return the cell.
return cell;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
NSInteger entityCount = [[coreDataObject userEntities] count];
return entityCount;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger entityIndex = [indexPath row];
Entity *entity = [[coreDataObject userEntities] objectAtIndex:userEntityIndex];
}
-(void)nameInputted:(NSString *)name
{
UICollectionView *collectionView = [self collectionView];
NSInteger rowNum = [collectionView numberOfItemsInSection:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:rowNum inSection:0];
[collectionView insertItemsAtIndexPaths:@[indexPath]];
[self dismissViewControllerAnimated:false completion:nil];
}