【发布时间】:2015-06-16 23:23:21
【问题描述】:
我有一个自定义表格视图单元格,我让自动布局管理它的高度。
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableViewAutomaticDimension
在 tableview 单元格内,我有一个容器子视图:
contentView.addSubview(calendarEventContainerView)
我添加的所有内容都在calendarEventContainerView 中,我希望子视图至少为 120pts,但同时,我希望它被固定到 contentView(以便它拉伸内容查看)。我唯一可以让它正确显示的时候是当我收到一个错误说我的代码不能同时满足约束时。这是我的约束代码:
calendarEventContainerView.autoPinEdgeToSuperviewEdge(.Top, withInset: CalendarEventLayout.verticalInset)
calendarEventContainerView.autoPinEdgeToSuperviewEdge(.Leading, withInset: CalendarEventLayout.horizontalInset)
calendarEventContainerView.autoPinEdgeToSuperviewEdge(.Trailing, withInset: CalendarEventLayout.horizontalInset)
calendarEventContainerView.autoPinEdgeToSuperviewEdge(.Bottom)
calendarEventContainerView.autoSetDimension(.Height, toSize: 120, relation: NSLayoutRelation.Equal)
任何想法我做错了什么?
【问题讨论】:
标签: ios swift uitableview autolayout