更改UITableViewCell内部的UIView高度



我正在尝试更改tableView内部的UIView高度。UIView高度不应超过单元格高度。

我试图设置view的边界,但它没有影响视图。

我如何修复这个问题并更改view 的高度

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    UIView *view=(UIView *)[cell viewWithTag:999];
    view.backgroundColor=[UIColor redColor];
    [view setBounds:CGRectMake(view.bounds.origin.x, view.bounds.origin.y, view.bounds.size.width, 400)];
    return cell;
} 

我找到了另一种方法:在视图高度约束中添加一个标识符。我可以像这样在控制器中访问它。。link->Interface Builder中有没有一种方法可以将标识符添加到Auto Layout Constraints?

最新更新