How can I add text to my subtitles? currently I have a NSArray with a list of names, how do I add subtitles for the names?
lodgeList = [[NSArray alloc]initWithObjects:
@"Abingdon Lodge No. 48",
@"York Lodge No. 12",
@"Alberene Lodge No. 277",
nil];
Continues…
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text =[lodgeList objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
Assuming you are using a standard UITableViewCell, make sure you set the table cell’s style to
UITableViewCellStyleSubtitle, then set the subtitle text by setting the cell’sdetailTextLabel.textproperty.