更改UITableViewCell内的UIView高度

时间:2016-04-18 11:12:06

标签: ios objective-c uitableview 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;
} 

1 个答案:

答案 0 :(得分:0)

我找到了另一种方法。为视图高度约束添加标识符。我可以在这样的控制器中访问它..链接 - > Is there a way to add an identifier to Auto Layout Constraints in Interface Builder?