开发者

UILabel multiple line in UITableViewCell

开发者 https://www.devze.com 2023-03-09 02:48 出处:网络
I have created a custom view cell with a UILabel in it, I have set : cell.titleLabel.lineBreakMode = UILineBreakModeWordWrap;

I have created a custom view cell with a UILabel in it, I have set :

 cell.titleLabel.lineBreakMode = UILineBreakModeWordWrap;
       cell.titleLabel.numberOfLines = 0;

and it's not going in multiple lines, why is this?

in the layoutSubviews I have:

- (void)layoutSubviews {
    [super layoutSubviews];

    CGRect frame = titleLabel.frame;
    frame.origin.y = 5;开发者_JAVA技巧
    titleLabel.frame = frame;
}

and that's about all the settings I have, however for a long text put in the label in the cell it just won't word wrap:

UILabel multiple line in UITableViewCell


What is the height of the label's frame? It needs to be tall enough to hold more than one line of text. Check out Adjust UILabel height depending on the text

0

精彩评论

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