0

End Goal: To create a view similar to this.

enter image description here

This is like a name tag. The red circle is the profile Image, The text(UILabel) is the name. Now, I have embedded them in a stackview which is put in a UIBlurview. I want a behavior where If the length of the name changes, the blur view extends automatically.

What am I doing now : I have constrained the leading and trailing spaces of stackview in the blur view with a little padding on all 4 sides. Added the height constraint to the stackview. But some how i am failing to receive the results. The thing is, I want the text/stackview perfect padded with blurview around it.

Any suggestions on how can I achieve this? I am comfortable with both the storyboards and programming this.

Thanks

Aakash Dave
  • 866
  • 1
  • 15
  • 30
  • 1
    What results are you getting? – Lincoln Green Oct 27 '18 at 06:05
  • The stackview doesn’t resize. It gets to the max size and then remians the same when a shorter string appears – Aakash Dave Oct 27 '18 at 06:22
  • 1
    The stack view can calculate its size based on its subviews intrinsic content size, you can try adding your label and icon to a container view and add top, leading, trailing and bottom constraints to your label and icon. – Francesco Deliro Oct 27 '18 at 08:53
  • @FrancescoDeliro Well I had done the same exact thing. I just realized I had put a height contrasint on the UIlabel, which somehow was preventing it from resizing. It shouldn't matter actually, since we are concerned with the width, but it's weird that it was hindering the resize of the stackview autolayout. – Aakash Dave Oct 27 '18 at 22:33

0 Answers0