2013-02-28 28 views
0

我有一個tableView,我需要顯示textlabeldetailtextlabelcell.detaillabel的文本沒有顯示

但未顯示detailtextlabel

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 
    static NSString *[email protected]"Cell"; 
    UITableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if(cell == nil){ 
     cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease]; 
     } 

     NSMutableDictionary *d2 =[[NSMutableDictionary alloc]initWithDictionary:[autocompleteUrls objectAtIndex:indexPath.row]]; 

     cell.textLabel.text = [NSString stringWithFormat:@"%@",[d2 valueForKey:@"FLName"]]; 
     [email protected]"Id"; 
     cell.textLabel.font=[UIFont boldSystemFontOfSize:12]; 
     cell.textLabel.numberOfLines=0; 

     return cell; 
} 

但是detailtextlabel沒有顯示,爲什麼?

回答

4

您使用UITableViewCellStyleDefault但你必須使用UITableViewCellStyleSubtitle

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

我通常在這種情況下使用UITableViewCellStyleValue1

[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease] 
-1

給你詳細回答:

enter image description hereenter image description here