-2
我用这个来设置为textLabel在一个UITableViewCell的子视图:为textLabel作为子视图
UILabel *text = [[UILabel alloc] initWithFrame:(0, 275, 0, 0)];
[text setText:contentString];
[cell addSubview:text];
但文字不显示。代码有问题吗?
我用这个来设置为textLabel在一个UITableViewCell的子视图:为textLabel作为子视图
UILabel *text = [[UILabel alloc] initWithFrame:(0, 275, 0, 0)];
[text setText:contentString];
[cell addSubview:text];
但文字不显示。代码有问题吗?
UILabel *text = [[UILabel alloc] initWithFrame:(0, 275, 50.0, 50.0)];
[text setText:contentString];
[cell addSubview:text];
使用此代码:)
显然....
UILabel *text = [[UILabel alloc] initWithFram:(0, 275, 0, 0)];
你给高度和标签的宽度为0
initWithFrame:(x-coordinate, y-coordinate, width, height)
O好吧,我想他们是0时,它是多行。嗯,这是一个可变的文本我可以设置高度变量的文本呢? – 2013-03-08 12:58:36
对于多行,您需要设置该标签的numberoflines属性。 – 2013-03-08 12:59:50
您可以参考此链接:http://stackoverflow.com/questions/6659923/a-generic-function-to-find-height-for-label-by-passing-the-string-that-the-label – 2013-03-08 13:03:29