1
votes

I am having a view & image.My view is always in center of the super view.I want add an image around the view.I am able to add the view but the problem is height & width is the issue.So please tell me how set constraints for the height & width of the image view.

Below are constraints for the image view

  • Horizontal center

  • vertical center

  • equal width to parent view(1.7 multiplier)

  • aspect ratio

As you can see there is some space between the view & the image on the right side.Please tell me how to fix this issue?

2
Can you share your project? - Rajesh Maurya
See if you want to look user interface as you have created in Storyboard, you should add four contraint like top, bottom, leading and trailing. Apply this constraint to both control. May be it help you? - Rajesh Maurya
Issue is i want to move the image with view.So if i put the that constraint image will not be moved correctly. - Dheeraj Kumar
Add both control into one view and apply constraint relatively. - Rajesh Maurya
can u post screen shots what u want - Nischal Hada

2 Answers

1
votes

You can add an aspect ratio constraint in IB by control dragging from the view to itself and choosing aspect ratio.

Ans here..

0
votes

Press cmd and select both the images OR view in which the images are. Then go to Editor -> Pin -> Horizontal spacing and set the spacing to 0.