2011-09-09 26 views
4

detailTextLabelは、ソースがそこにあると考えられるので、表示されません。それに応じてtextLable.textも表示されます。 listDicUITableViewCellを設定できませんdetailTextLabel.text

- (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

listDic:{ 
    Address = myAddress; 
    Description = myDescription; 
} 

答えて

10
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 

あなたはinitWithStyleを使用する必要があります。UITableViewCellStyleSubtitle

0

スウィフト(3)

let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cellIdentifier") 
関連する問題