xcode 在 ios 中显示 3.5 英寸和 4 英寸屏幕的高度相同
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20328239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xcode shows same height for 3.5 inch and 4 inch screen in ios
提问by Seeker
I test my app in 3.5 inch and 4 inch. While I NSLog(@"%@", self.view.frame.size.height);
both 3.5 inch and 4 inch shows height 568. Now currently I m using xcode 5.. Any can please explain why this shows like that..
我在 3.5 英寸和 4 英寸上测试了我的应用程序。虽然我NSLog(@"%@", self.view.frame.size.height);
3.5 英寸和 4 英寸都显示高度568。现在我正在使用 xcode 5 .. 任何人都可以解释为什么会这样显示..
回答by Pradhyuman sinh
I think you are using self.view.frame.size.height . In this condition app using your original view means your xib's height and may be your xib is 4 inch.
我认为您正在使用 self.view.frame.size.height 。在这种情况下,使用您的原始视图的应用程序意味着您的 xib 的高度,并且您的 xib 可能是 4 英寸。
If you want to check UIDevice height than use this condition
如果你想检查 UIDevice 高度而不是使用这个条件
if ([UIScreen mainScreen].bounds.size.height<568)
{
NSLog(@"3.5 inch screen");
}
else
{
NSLog(@"4.0 inch screen");
}
回答by user2261451
You should have two launch images- one Default.png (for 3.5 inch) and another Default-568h.png (for 4 inch) in your app. Please check it.
您的应用程序中应该有两个启动图像 - 一个 Default.png(用于 3.5 英寸)和另一个 Default-568h.png(用于 4 英寸)。请检查一下。
回答by Dharmbir Singh
It is returning because your xib size is Retina 4-inch Full Screen. So thats why. So if you really want to it then change it in your xib file either freeformor None.
它正在返回,因为您的 xib 尺寸是 Retina 4 英寸全屏。所以这就是为什么。所以,如果你真的想它,然后改变它在你的XIB文件无论是自由或无。
Please try to see like this...Definataly it will print according to your screen.
请尝试这样看...肯定会根据您的屏幕打印。
NSLog(@"%f",[[UIScreen mainScreen ] bounds].size.height);