简体   繁体   English

更改IOS Sdk中的Cell.TextLabel宽度

[英]Change the Cell.TextLabel Width in IOS Sdk

I want to change the width for the cell TextLabel because it overlap the my custom buttons. 我想更改width for the cell TextLabelwidth for the cell TextLabel因为它与我的自定义按钮重叠。

I try the following code but it removes the cell separation line. 我尝试以下代码,但它删除了细胞分离线。

@interface CustomTableViewCell : UITableViewCell
@end

@implementation CustomTableViewCell

- (void)layoutSubviews
{
    CGRect textLabelFrame = self.textLabel.frame;

    textLabelFrame.size.width=250.0f;
    self.textLabel.frame = textLabelFrame;
}

Help me to solve this problem. 帮我解决这个问题。

Have you tried adding [super layoutSubviews] at the start of your layoutSubviews. 您是否尝试在[super layoutSubviews]的开头添加[super layoutSubviews] You won't get the default behaviors of your class, such as the cell separation line otherwise. 您不会获得类的默认行为,例如细胞分离线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM