Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/danielgindi/Charts
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/danielgindi/Charts:
  Refactors -[tableView:cellForRowAtIndexPath:] (ChartsOrg#3326)
  • Loading branch information
FreddyZeng committed Mar 14, 2018
2 parents 8b4d125 + 695979e commit 1ff4668
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions ChartsDemo/Objective-C/DemoBaseViewController.m
Expand Up @@ -170,7 +170,8 @@ - (IBAction)optionsButtonTapped:(id)sender
_optionsTableView.backgroundColor = [UIColor colorWithWhite:0.f alpha:0.9f];
_optionsTableView.delegate = self;
_optionsTableView.dataSource = self;

[_optionsTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];

_optionsTableView.translatesAutoresizingMaskIntoConstraints = NO;

NSMutableArray *constraints = [[NSMutableArray alloc] init];
Expand Down Expand Up @@ -224,23 +225,14 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView == _optionsTableView)
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
cell.backgroundView = nil;
cell.backgroundColor = UIColor.clearColor;
cell.textLabel.textColor = UIColor.whiteColor;
}

cell.textLabel.text = self.options[indexPath.row][@"label"];

return cell;
}

return nil;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.backgroundView = nil;
cell.backgroundColor = UIColor.clearColor;
cell.textLabel.textColor = UIColor.whiteColor;

cell.textLabel.text = self.options[indexPath.row][@"label"];

return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
Expand Down

0 comments on commit 1ff4668

Please sign in to comment.