Last active
August 29, 2015 13:56
-
-
Save thoretton-edwin/9015907 to your computer and use it in GitHub Desktop.
iOS TableView cell methods with tab of NSDictionnary. tags : UITableView,UITableViewCell,cell,table view
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
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
return [tab count]; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) | |
{ | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; | |
// Configure the cell... | |
cell.textLabel.text = [[tab objectAtIndex:indexPath.row] objectForKey:@"nom"]; | |
cell.backgroundColor = [[tab objectAtIndex:indexPath.row]objectForKey:@"couleur"]; | |
/* other methods of standard cell | |
[cell.textLabel setText:@"text"]; | |
[cell.detailTextLabel setText:@"text"]; | |
[[cell textLabel]setFont:[UIFont boldSystemFontOfSize:24]]; | |
[[cell detailTextLabel]setFont:[UIFont systemFontOfSize:16]]; | |
We can config the imageView of cell too ... | |
*/ | |
} | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment