-
-
Save PhilipBale/dc5840fc1c96bceba588 to your computer and use it in GitHub Desktop.
Form descprition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CreateEventViewController () | |
@property(nonatomic, strong) FORMDataSource *sourceData; | |
@end | |
@implementation CreateEventViewController | |
- (FORMDataSource *)dataSource { | |
if (_sourceData) return _sourceData; | |
NSArray *JSON = [NSJSONSerialization JSONObjectWithContentsOfFile:@"CreateEvent.json"]; | |
_sourceData = [[FORMDataSource alloc] initWithJSON: JSON | |
collectionView:self.collectionView | |
layout:[FORMLayout new] | |
values:nil | |
disabled:NO]; | |
__weak typeof(self)weakSelf = self; | |
_sourceData.configureCellBlock = ^(FORMBaseFieldCell *cell, NSIndexPath *indexPath, FORMField *field) { | |
cell.field = field; | |
}; | |
_sourceData.fieldUpdatedBlock = ^(FORMBaseFieldCell *cell, FORMField *field) { | |
}; | |
return _sourceData; | |
} | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.collectionView.dataSource = self.dataSource; | |
self.collectionView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f); | |
} | |
- (CGSize)collectionView:(UICollectionView *)collectionView | |
layout:(UICollectionViewLayout *)collectionViewLayout | |
sizeForItemAtIndexPath:(NSIndexPath *)indexPath { | |
return [self.dataSource sizeForFieldAtIndexPath:indexPath]; | |
} | |
- (void)didReceiveMemoryWarning { | |
[super didReceiveMemoryWarning]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment