2011-07-26 23 views
0

如何在不使用自定義單元格的情況下重現消息UITableViewCell樣式?重現UITableViewCell樣式

目前,我使用的是UICellStyleWithSubtitle,並添加了附件,但我只能看到日期,並且隱藏了UITableViewCellAccessoryDisclosureIndicator。

我想要什麼:

http://www.askdavetaylor.com/4-blog-pics/iphone-text-txt-message-haiti-2.png

我在做什麼:

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 45, 15)]; 
    [myLabel setText:[NSString stringWithFormat:@"%@", [table returnDate]]]; 
    [myLabel setAdjustsFontSizeToFitWidth:YES]; 
    [myLabel setTextColor:[UIColor blueColor]]; 
    [myLabel setBackgroundColor:[UIColor clearColor]]; 
    cell.accessoryView = myLabel; 
    [myLabel release]; 
    cell.textLabel.text = table.title; 
    cell.detailTextLabel.text = table.subtitle; 

回答

0

試試這個,

cell.detailTextLabel.text = [table returnDate] 

而是採用拉貝l只需將值分配給detailTextLabel,並將單元格樣式設置爲UITableViewCellStyleValue1

+0

是,但我不能添加字幕,然後。 –

+0

這裏你把標籤設置爲_accessoryView_,所以它隱藏了指標。嘗試將標籤添加爲_accessoryView_ ** subView **。 – Sisu

0

對於這一點,你不必使用UICellStyleWithSubtitle..u可以使用UITableViewCellStyleValue1與細胞樣細胞detailTextLabel財產嘗試: cell.detailTextLabel.text = @"Yesterday";