How to optimize screen size designed for 4 inch compatible with 3.5 inch

旧城冷巷雨未停 提交于 2020-01-02 16:56:04

问题


I have made a 4inch app using story board . However I found out that I have to support 3.5 inch screens as well. So I went to the storyboard and clicked on the button that switches the display size from 4inch to 3.5 since in 3.5 inch my app is cutoff at the bottom. However I finishes designing on 3.5 inch and went back to 4inch. The problem is that even in 4 inch the design is for 3.5 inch. How can I have a layout for 3.5inch and 4 inch? I am not using auto layout.


回答1:


You have two main options:

Use autolayout to auto rezie/move the views depending on the size of the screen.

Use 2 different storyboards and load one or the other depending on the size of the screen.




回答2:


using 2 storyboard is the only option to differentiate the device

#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

write the above code in app delegate above #import"appdelegate" and check condition in [method]- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

as

if(IS_IPHONE_5)

{

// load your iPhone5 storyboard

}

else
{

// load  other than iPhone5 storyboard

}


来源:https://stackoverflow.com/questions/20632039/how-to-optimize-screen-size-designed-for-4-inch-compatible-with-3-5-inch

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