gpt4 book ai didi

ios - UITableViewCell 冲突的高度约束

转载 作者:行者123 更新时间:2023-11-28 07:05:03 25 4
gpt4 key购买 nike

我有一个自定义的 tableview 单元格,我让自动布局管理它的高度。

tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableViewAutomaticDimension

在 tableview 单元格内我有一个容器 subview :

contentView.addSubview(calendarEventContainerView)

我添加的所有内容都在 calendarEventContainerView 中,我希望 subview 至少为 120pts,但与此同时,我希望它固定到 contentView (这样它就可以拉伸(stretch) 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)

知道我做错了什么吗?

最佳答案

出于不为人知的原因,将约束的优先级设置为 999 似乎可以解决自动调整 UITableViewCell 大小的问题。

关于ios - UITableViewCell 冲突的高度约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30879886/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com