Reputation: 69
i've got a simple question. How to set up an UITableView with multiple details. I've got plist where i'm storing all the details.
This what I did for just one details.cell.textLabel.text = [[self.array objectAtIndex:indexPath.row] objectForKey:@"name"];
What to do if I want 2 details on my cell?
Many Thanks in advance.
Upvotes: 0
Views: 122
Reputation: 2616
First off you need to set the type of cell you want, if you want a title plus detail you can do this:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
then for setting the title and detail labels, just
[cell textLabel].text = @"some title"
[cell detailTextLabel].text = @"some detail text"
Upvotes: 1
Reputation: 6176
If your not happy with using cell.detailTextLabel
and one of the provided styles(set up from storyboard) then one option would be to create a custom UITableViewCell
.
You can either create a xib and drag and drop a cell in and customize it from there or if your only using 1 table it may be easier to use a prototype cell and customize it directly in your table. The key part is to create a new Class to support your cell.
Upvotes: 0