开发者

NSDateFormatter

I'm trying to create a TableViewCell like the one in the Notes app on the iPhone. Have the title on the left and the time on the right next to the discloser indecator.

A tableView which would look like that. I know I have to use something like开发者_如何学Go this

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"HH:mm zz"];

NSDate *dateTmp;
dateTmp = [[self.Notes objectAtIndex:indexPath.row ]objectForKey:@"CDate"];
cell.detailTextLabel.text = [dateFormat stringFromDate: dateTmp];

http://cl.ly/3Mpj

How would I move the detail label to the top next the the discloser indecator?


Use should create a custom cell... Place two buttons accordingly... Here i did like this...

NSDateFormatter


I think you still want the time to be the detail label? If so the first option could work..

There are a few options:

You could try to simply set the detailLabel's text alignment with something like cell.detailTextLabel.textAlignment = UITextAlignmentRight

Or if this doesn't fit your needs, you can always subclass UITableViewCell and create your own cell with placement however you need it.

Edit: on rereading your post, you want the time Label to be on the same "row" as the name, and on the right..for this you are probably going to want to use a custom UITableViewCell, that way you can place and format your labels exactly how you want them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜