开发者

do I need separate UILabel in a custom UIView to have separate UILabel lines in a UITableViewCell?

do I need separate UILabel in a custom UIView to have separate UILabel lines in a UITableViewCell?

That is, if I want to have a TableViewCell that has all text, but the text needs to contain 4 separate rows for 4 separate strings (e.g. Name, Title, Description, Location), and each these separate rows could include a wrap around.

To ask the question the other way around, is there way with a normal UITableViewCell using it content view and single text label, to force Carriage Return/New Line points at the end of each of the four strings? Oh yes, and the cell height will need to be calculated for each Cell as it may vary (just in case this is significant开发者_开发技巧)


The answer to the last question: NO. (Answer to the title: YES.)

You can build a cell in its own NIB file. An exercise I suggest if you've never done it.

Layout the size/location/resize functionality as you like it.

your table view controller can be the owner of the file, add an outlet to the TV controller of loadedCell, and call load nib every time you want to alloc a new cell,

i suggest tagging each of the cell labels, and accessing them that way, and setting the loadedCell value to nil after loading it,

p.s. a UILabel often wraps text undesirably, or is hard to layout in a cell to look good, consider the other values of lineBreakMode for your labels

p.p.s. it will employ a text shortening behavior depending on adjustsFontSizeToFitWidth and minimumFontSize (taking this and lineBreakMode into consideration)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜