Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving UIStackView Layout Ambiguity

I have a custom UITableViewCell that has the following elements:

  • UIImageView
  • UILabel
  • UILabel

I want the UIImageView on the left, and the 2 UILabel objects stacked one on the other on the right side. Here's what it looks like in the storyboard:

StackView

I've got a horizontal UIStackView. Inside it is the UIImageView and a vertical UIStackView.

Here's what the hierarchy looks like:

hiearchy

For some reason, I'm getting warnings on ambiguity for the title and description labels. I've tried to tweak them again and again but I couldn't get it quite right. Any advice is appreciated.

like image 887
Kelvin Lau Avatar asked Mar 27 '16 23:03

Kelvin Lau


1 Answers

Make the vertical stackview as fill equally

What I would do is to fix aspect ratio or size of image and make horizontal stack view as equally fill

If image size is variable then I would set the content hugging priority of image higher to the vertical stack view so that it displays entire image without cropping and vertical stack view with fill equally.

like image 69
ahmed Avatar answered Oct 11 '22 11:10

ahmed