Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

whitedragon101

macrumors 65816
Original poster
Sep 11, 2008
1,337
334
- For autosizing content to cope with both iphone 4 /5 screens you can use auto constraints which are well documented.
- For moving content up apple recommend using a scrollview and scrolling all the content.

However doing both (which I would have thought is hugely common) is not well documented at all and seems needlessly complicated.

Please could you have a look at my solution for doing both and see if its ok and if Apple would accept it when I submit. If it is I will go ahead an apply to all my app screens. Its probably easier just to look at the attched code but as a list this is basically what I have done :

https://www.dropbox.com/s/5radolkws0s1w6h/testAutolayout.zip

Code:
1) place a scrollview on the viewcontroller and set its class to TPKeyboardAvoidingScrollView (this is open source and detects text felid events and moves the content up, this saves having to add custom code to every view controller).
2) set the scrollview constraints for leading,trailing,top,bottom to 0
3) place a view inside the scrollview set leading and top constraints to the scrollview to 0 (not trailing or bottom), set view to centre x and centre y
4) add 2 text areas one for display and one for entry and a button
5) set the buttons bottom constraint to the view to keep it at the bottom of the screen
6) set the un-editable text areas top constraint to give it a distance to the top of the screen
6) set a height for the button and un-editable text area
7) set top and bottom distances for the editable text area so it expands or contracts to fit both screen sizes
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.