tech savvy
tech savvy

Reputation: 1435

UIButton inside UIScrollview not resizing with UIScrollView even after adding the constraints

I am facing a weird issue. I have implemented custom UIButtons as a Tile View in a UIScrollView which is added to superview. It is like there are six buttons, set of two placed sideways, and next set of 2 below them and so on. Now for implementing it to fit all iPhones Screen Sizes, I have added proper constraints to UIScrollView and constraints to UIButton relative to each other and UIScrollView. I have added @2x background images to each of the button with resolution as 320 *320. I have not provided any heights and widths constraints to them, so that they stretch freely according to different screen sizes.

xib has been initially designed as a 4" screen size. UIScrollView frame is stretching, however button remain positioned as in an iPhone 5S xib, hence it is looking improper on screens like iphone 6 etc.

What is the exact problem here?

Upvotes: 0

Views: 211

Answers (1)

Mahesh Agrawal
Mahesh Agrawal

Reputation: 3358

See the work done here and confirm if this is correct. I have added constraints required to make the buttons looks proper in all devices.

here is the link

https://github.com/mahesh-agrawal/Test-Buttons-Inside-ScrollView

Upvotes: 1

Related Questions