Ios 需要滚动UITableView以更新UITableViewCell内的UILabel框架

Ios 需要滚动UITableView以更新UITableViewCell内的UILabel框架,ios,uitableview,uilabel,frame,Ios,Uitableview,Uilabel,Frame,我想根据特定条件更新UITableViewCell内的UILabel帧(仅原点.y位置),因此,我使用该代码来实现: - (void)tableView:(UITableView *)tableView willDisplayCell:(EventsCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if([[arrayofImages objectAtIndex:indexPath.row]isEqualToString:@"

我想根据特定条件更新
UITableViewCell
内的
UILabel
帧(仅原点.y位置),因此,我使用该代码来实现:

- (void)tableView:(UITableView *)tableView willDisplayCell:(EventsCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if([[arrayofImages objectAtIndex:indexPath.row]isEqualToString:@"no image"]){
        [cell.imageImageView removeFromSuperview];
        cell.imageImageView=nil;
        cell.yearLabel.frame=CGRectMake(cell.yearLabel.frame.origin.x,42, cell.yearLabel.frame.size.width, cell.yearLabel.frame.size.height );
    }
}
问题是我需要滚动
UITableView
单元格以更新
UILabel
的帧(将y位置设置为42)。 为什么我会遇到这样的问题,甚至在创建单元格之前就执行了此代码(在
willDisplayCell
delegate方法中)。
感谢您的帮助。

这可能是由于自动布局造成的。如果不更改框架,而是在标签和单元格顶部之间的约束上创建一个IBOutlet,并修改其常量值,则它应该可以正常工作(topCon是我的约束出口)

- (void)tableView:(UITableView *)tableView willDisplayCell:(EventsCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if([[arrayofImages objectAtIndex:indexPath.row]isEqualToString:@"no image"]){
        [cell.imageImageView removeFromSuperview];
        cell.imageImageView=nil;
        cell.topCon.constant = 42;
    }
}