开发者

iPhone SDK: How to add multiple labels to table cell?

I am trying to create a custom table cell that has multiple labels. I already have code to create a custom cell. My problem is, 开发者_开发问答it is just not that pretty. What I need is some pointers on how to apply multiple labels each of which may be a different color, font, etc.

These are the labels I would like to include and they should appear centered one after another.

a.) Name b.) Address1 c.) Address2 d.) Phone

Any pointers or links to examples greatly appreciated.


You need to create a custom cell with the labels on them however you desire. It can easily be done, and I have done it before. It's not really hard, Apple has sample code on creating custom cells available on the portal that you should have a look at if you can't envision how to do this.


Is this what you wanted? Replace cell with self if it is in a UITableViewCell subclass...

UILabel *name = [[UILabel alloc] initWithFrame:whatever];
[name setText:@"something"];
[cell addSubview:name];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜