【发布时间】:2014-06-26 04:49:19
【问题描述】:
我正在使用自动布局。我有一个 UIView 作为自定义 UITableViewCell 的子视图。在 cellForRow 中,我想在单元格中为 Row 设置 UIView 的框架。
这是我所拥有的:
UIView *bar;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
bar = (UIView *)[cell.contentView viewWithTag:2];
[bar setFrame:CGRectMake(bar.frame.origin.x,
bar.frame.origin.y,
10,
bar.frame.size.height)];
}
如果我关闭自动布局,它会起作用。如何使用自动布局来完成此操作?我已经彻底搜索了,但没有找到解决方案。
【问题讨论】:
标签: uitableview autolayout subview