Search code examples
iosobjective-cuiviewuiscrollviewautoresizingmask

Autosizing mask attaching the UIView to the bottom of the screen not the UIScrollView


I have a UIScrollView with 480 height, so on 3,5-inch iPhone the scroll is enabled to view the content because of the navigation bar. I have two UIView which should be in the bottom part of the UIScrollView. I try to solve this issue without the manual adjustments in the code and use only IB for this purposes. So, if I try to set for this UIViews the autosizing mask like this:

enter image description here

on 3,5-inch screen (small one) the UIViews are attaching to the bottom of the screen not to the bottom part of the UIScrollView.

The autosizing mask for the UIScrollView looks like this:

enter image description here

when I try to change the autosizing mask for the views to:

enter image description here

the problem is with 4-inch screen - the image is not attaching to the bottom of the page..

Any help?


Solution

  • If you want to show the Bottom View at the bottom of the UIScrollView not self.View.Then

    • Take a UIView(myView).Add UIScrollView and your bottomView (which you want to show at the bottom of the UIScrollview) to myView.Then Your auto resizing will work as expected.Refer below Image

    image