How to resize App for Iphone 5?

久未见 提交于 2019-12-12 10:22:40

问题


I'm creating a universal app. Everything is looking great on the ipad/iphone but when I switch my storyboard view to the iphone 5 or run the simulator as the iphone 5, there is an inch or so at the bottom of just whitespace. I've tried turning on autolayout and using that, but with no luck. I've also tried to create -568h@2x.png versions of my images to see if it will auto-resize with those, but it doesn't. Does anyone have any other ideas I could perhaps try?

Thank you!


回答1:


I found the way to fix this was to use the AutoResizing box in the size inspector in Xcode. It's the box with the red lines. The red box next to it animates to show you how it changes as the view (the white box) changes size. This changes the autoresizingMask in the storyboard. You can make the image scale or not or keep distance to an edge: Just click on the different red lines to see how the red box changes. I had to do this for every button and image in the game.

You also need to check 'Autoresize Subviews' in the parent view in the Attributes Inspector.

And you do need Default-568h@2x.png to get rid of the letterbox in the first place.




回答2:


If you a simple application using table views and detail views and just want t expand screen height. Try this: 1. open up your mainstoryboard_iphone as source 2. look for autorisizingMask element: `" **

key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>** "`
. It should be somewhere in the viewController element "view" i.e.:



<view key="view" contentMode="scaleToFill" id="UrG-Iu-edE">
                        <rect key="frame" x="0.0" y="20" width="320" height="460"/>
                        **<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>**    
3. and change into: 

**<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>**

For me there was no need to use another storyboard.




回答3:


You can try clicking on the view, going to the attributes inspector, and selecting "Retina 4 Full Screen". You'll have to manually resize the things inside your view though.



来源:https://stackoverflow.com/questions/12697870/how-to-resize-app-for-iphone-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!