If you are willing to use Auto layout, your problems can be solved using the following steps:
- In the Storyboard, select the view - go to "file inspector" and check the box named "Use Autolayout"
- Add the following constraints:
- Top space to container
- Bottom space to container
- Leading space to container and
- Trailing space to container
This will -
- Just work
- Will be sustainable even when Autoresizing will no longer be used.
Edit
Check if the auto layout is turned off. If it is not, and you are trying to make the autoresize work through code, you will need to do the following for all the views you want to work with your autoresizing masks:
self.view.translatesAutoresizingMaskIntoConstraints = YES;