Created
January 19, 2014 04:36
-
-
Save dread-pirate-bob/8500526 to your computer and use it in GitHub Desktop.
UITableView Boilerplate
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
| #pragma mark - TableView DataSource | |
| -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| return 50.0; | |
| } | |
| -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
| return 1; | |
| } | |
| -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| return apiCalls.count; | |
| } | |
| -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; | |
| if (cell == nil) { | |
| cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"]; | |
| } | |
| NSDictionary *item = apiCalls[indexPath.row]; | |
| cell.textLabel.text = [item objectForKey:@"Endpoint"]; | |
| cell.detailTextLabel.text = [item objectForKey:@"Verb"]; | |
| cell.textLabel.textColor = [UIColor greenColor]; | |
| cell.detailTextLabel.textColor = [UIColor greenColor]; | |
| cell.backgroundColor= [UIColor blackColor]; | |
| return cell; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment