Reputation: 2824
The detailTextLabel is not displayed out accordingly thought the source is there. The textLable.text is displayed accordingly though.
- (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] autorelease];
}
// Configure the cell...
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"favouriteListArray"] != nil) {
NSArray *listArray = [NSArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"favouriteListArray"]];
NSLog(@"listArray:%@", listArray);
NSDictionary *listDic = [listArray objectAtIndex:indexPath.row];
NSLog(@"listDic:%@", listDic);
cell.textLabel.text = [listDic objectForKey:@"Description"];
cell.detailTextLabel.text = [listDic objectForKey:@"Address"];
}
return cell;
}
NSLogs of listDic
listDic:{
Address = myAddress;
Description = myDescription;
}
Upvotes: 4
Views: 3139
Reputation: 6775
Swift (3)
let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cellIdentifier")
Upvotes: 0
Reputation: 2216
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
You need to use initWithStyle:UITableViewCellStyleSubtitle
Upvotes: 10