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連接到自定義單元類 –