Ios UILabel在向左滑动时正在调整大小(使用自动布局和代码)

Ios UILabel在向左滑动时正在调整大小(使用自动布局和代码),ios,uitableview,ios6,autolayout,Ios,Uitableview,Ios6,Autolayout,当我滑动以删除UITableCell子类ExpenseCell时,我有一个奇怪的大小调整: 下面是我用来根据UILabel的内容调整其大小的一段代码: -(void)layoutSubviews{ [super layoutSubviews]; NSInteger leftMargin = 0; if (![descriptionLabel.text isEqualToString:@""]){ leftMargin = 15; }

当我滑动以删除UITableCell子类ExpenseCell时,我有一个奇怪的大小调整:

下面是我用来根据UILabel的内容调整其大小的一段代码:

-(void)layoutSubviews{
    [super layoutSubviews];

    NSInteger leftMargin = 0;

    if (![descriptionLabel.text isEqualToString:@""]){
        leftMargin = 15;
    }

    CGSize descriptionLabelSize = [descriptionLabel.text sizeWithFont:descriptionLabel.font];
    CGRect descriptionLabelRect = CGRectMake(descriptionLabel.frame.origin.x,
                                         descriptionLabel.frame.origin.y,
                                         descriptionLabelSize.width,
                                         descriptionLabelSize.height);
    descriptionLabel.frame = descriptionLabelRect;

    CGSize categoryLabelSize = [categoryLabel.text sizeWithFont:categoryLabel.font];
    CGRect categoryLabelRect = CGRectMake(descriptionLabel.frame.origin.x + descriptionLabel.frame.size.width + leftMargin,
                                      categoryLabel.frame.origin.y,
                                      categoryLabelSize.width,
                                      categoryLabelSize.height);
    categoryLabel.frame = categoryLabelRect;
}
如果我对上面的代码进行注释,我没有这个问题,但是我丢失了自动调整大小的UILabel

你们知道如何通过在AutoLayout上添加约束或更改现有代码来解决这个问题吗

提前谢谢