Reproduce UITableViewCell style
How may I reproduce the message UITableViewCell style, without using custom cells ?
F开发者_运维问答or the moment, I am using UICellStyleWithSubtitle, and I add accessories, but I can only see the date, and the UITableViewCellAccessoryDisclosureIndicator is hidden.
What I want :
http://www.askdavetaylor.com/4-blog-pics/iphone-text-txt-message-haiti-2.png
What I am doing :
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;
For this, you don't have to use UICellStyleWithSubtitle..u could use UITableViewCellStyleValue1 and try with detailTextLabel property of cell like:
cell.detailTextLabel.text = @"Yesterday";
Try this,
cell.detailTextLabel.text = [table returnDate]
instead of using label simply assign the value to detailTextLabel, and give cell style as UITableViewCellStyleValue1.
精彩评论