I have a custom UITableViewCell, it looks like this:
The warning I'm getting is:
Inequality Constraint Ambiguity: trailing >= date.trailing + 16
I highlighted the constraint in the picture above.
What I don't understand is, before 'someView' (the last view in the bottom) was added, there was no warning; When it was added without height = 20 constraint, there was no warning. However, as soon as the height constraint was added, I start to get the warning message.
I have to add the height constraint because without the it, the height of 'someView' is not 20 anymore.
If it helps, I am using
tableView.rowHeight = UITableView.automaticDimension
to decide the height of a row
I used the same UI of yours in UITableViewCell
:
The fields with width , height and aspect ratio has constraints as :
and all the remaining `constraints are as follows:
The only difference is I guess the height constraint to Name Label
. If I am adding that then I am getting constraint conflict issues. Removing that is not showing any issues and UI is also perfectly fine.
Hope this helps to figure out and fix your issue.
You've added a lot of unneeded heights for a dynamic cell. I honestly hate seeing labels with height constraints, as contentSize will set that height for you. When I used to run into layout issues, my Senior IOS Developer would tell me to delete it all and start again, lol. I would suggest this but it would be a terrible answer. It's also bad practice to have placeholder text in your labels/views. For some reason interface builder hates it. Just some tips.
You can download the example here: http://s000.tinyupload.com/index.php?file_id=02066350701605990856
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.