如何更改单元格的textLabel框架? [英] How can I change a cell's textLabel frame?
问题描述
我几乎尝试了所有东西,但我似乎无法将cell.textLabel属性向下移动一点点。我在下面附上了截图,我已经尝试了几乎所有我能找到的东西。
I've tried nearly everything, but I just can't seem to move the cell.textLabel property down a little bit. I've attached a screenshot below and I've tried nearly everything I could find.
我尝试直接更改.frame属性,尝试修改if使用 - (void)tableView:(UITableView *)tableView willDisplayCellmethod。我也尝试过分配一个自定义标签。我可以移动自定义标签,但不会像原来的textLabel一样进入单独的行。我只需要将图中的多行标签稍微移动一下。
I've tried changing the .frame property directly, attempted at modifying if via using the "- (void)tableView:(UITableView *)tableView willDisplayCell" method". I've also tried allocating a custom label. I could move the custom label, but it wouldn't go into separate lines like the original textLabel. I just need to move the pictured multi line label a bit down.
感谢任何帮助!
推荐答案
执行此操作的唯一方法是使用 UITableViewCell
子类并覆盖 -layoutSubviews
。在此方法中,您将要调用 [super layoutSubviews]
,然后对标签进行任何帧调整。
The only way to do this is to use a UITableViewCell
subclass and override -layoutSubviews
. In this method, you'll want to call [super layoutSubviews]
, and then do any frame tweaks that you want to the label.
这篇关于如何更改单元格的textLabel框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!