如何在xcode中编写代码,支持所有尺寸的iphone

时间:2013-04-03 04:36:40

标签: ios xcode ios6 xcode4

问题是,在viewcontroller.xib中保持大小为none,并编写了在iphone4和普通iphone中运行的代码,但视图不支持iphone5请告诉我如何设计所有iphone尺寸

1 个答案:

答案 0 :(得分:0)

我们需要记住的一件重要事情是你必须放置 Default-568h@2x.png 。然后它才开始支持iPhone 5。您必须编写此行来处理iPhone 5。 iPhone5的屏幕尺寸为640x1136。因此,除了背景图像之外,用于iPhone 4 / 4s的图像也适用于iPhone 5,因为iPhone 5中的视图高度为176像素。

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].scale * [UIScreen mainScreen].bounds.size.height>=1136)
    {
    // write some code here for positioning the element 

    }

如果您有任何问题,请告诉我