Last active
February 11, 2016 23:16
-
-
Save rbaulin/1fbc95c5efb8fb418164 to your computer and use it in GitHub Desktop.
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
- (instancetype)init | |
{ | |
self = [super initWithStyle:UITableViewStyleGrouped]; | |
if (self) { | |
} | |
return self; | |
} | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.tableView.delegate = self; | |
self.tableView.dataSource = self; | |
} | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
[self.tableView reloadData]; | |
} | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return 1; | |
} | |
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { | |
return @"header"; | |
} | |
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { | |
return @"footer"; | |
} | |
static NSString *const kCellIdentifier = @"Cell"; | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; | |
if (!cell) { | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier]; | |
} | |
cell.textLabel.text = @"cell"; | |
return cell; | |
} | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
[tableView deselectRowAtIndexPath:indexPath animated:YES]; | |
// action | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment