0
我确实试图让这件事情起作用。我读了很多文章,但没有一篇给出了适当的解决方案。我想从xcode中获得的所有内容都是让我通过编程方式更改单元格中imageview的顶部约束。我已经为ipad全屏设置了我的限制,但我想调整ipad Pro的几个限制。以编程方式更改单元格中的图像视图的约束条件
首先我想这:
- (void)updateConstraints
{
[super updateConstraints];
self.imageViewTopConstraint.constant = 300.f;
}
- (void)awakeFromNib {
// // Initialization code
[self setNeedsUpdateConstraints];
}
,并没有工作。
然后我试图把此行
self.imageViewTopConstraint.constant = 300.f;
在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
仍然没有工作。我调整了细胞高度,但它也没有工作。
你可以请我帮帮忙吗?
P.S:xcode的新手。
如何定义'imageViewTopConstraint'? –
你有没有试过[cell updateConstraintIfNeeded];改变约束后的常量值。 –
@InderKumarRathore我已将nslayoutconstraint的iboutlet连接到自定义单元类 –