Last active
November 8, 2015 02:47
-
-
Save DylanVann/4e863ca8310247260c19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| - (void)viewDidLaod { | |
| //Create cells. | |
| _tableViewData = @[ | |
| @{ | |
| @"title" : @"Section 1", | |
| @"cells" : @[ | |
| _eventCell | |
| ]}, | |
| @{ | |
| @"title" : @"Section 2", | |
| @"cells" : @[ | |
| _startTimeCell, | |
| _activityCell | |
| ]}, | |
| @{ | |
| @"title" : @"Section 3", | |
| @"cells" : @[ | |
| _deleteButtonCell | |
| ]} | |
| ]; | |
| } | |
| #pragma mark UITableViewDataSource | |
| - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| NSDictionary *sectionDictionary = [_tableViewData objectAtIndex:(NSUInteger) indexPath.section]; | |
| NSArray *cells = [sectionDictionary objectForKey:@"cells"]; | |
| UITableViewCell *cell = [cells objectAtIndex:(NSUInteger) indexPath.row]; | |
| return cell; | |
| } | |
| - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
| return [_tableViewData count]; | |
| } | |
| - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| NSDictionary *sectionDictionary = [_tableViewData objectAtIndex:(NSUInteger) section]; | |
| NSArray *cells = [sectionDictionary objectForKey:@"cells"]; | |
| return [cells count]; | |
| } | |
| - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { | |
| NSDictionary *sectionDictionary = [_tableViewData objectAtIndex:(NSUInteger) section]; | |
| return [sectionDictionary objectForKey:@"title"]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment