在 iOS 7(4 英寸视网膜显示屏)上运行应用程序时显示黑条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18913105/
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
Black bars showing when running app on iOS 7 (4 inch retina display)
提问by User0911
We have an iPod
app built with base SDK
as 5.1.
App has a tabBarController
with three tabs and each tab has a UIViewController
to load a different view.
我们有一个iPod
使用 base 构建的应用程序,SDK
因为5.1.
应用程序有一个tabBarController
带有三个选项卡,每个选项卡都有一个UIViewController
用于加载不同的视图。
The app works fine for iOS 6.1
and iOS 7
(3.5 inch display) simulator and device but when we run the app on
iOS 7
(4 inch display simulator) or device we are getting black bars at the top and bottom of the view screen in all three tabs.
If anyone can suggest reason for this or some feasible solution to this problem, it would be really helpful for us.
该应用程序适用于精细iOS 6.1
和iOS 7
(3.5英寸显示屏)模拟器和设备,但是当我们运行的应用程序
iOS 7
(4英寸显示屏仿真器)或设备,我们正在在所有三个选项卡的顶部和视图屏幕下方的黑条。如果有人可以提出这个问题的原因或解决这个问题的一些可行的解决方案,那对我们真的很有帮助。
Thanks
谢谢
回答by Nitin Gohel
First thing is that you must add the required default image for 4 inch screen display. Check Properly in you project have image with name [email protected](640 × 1136 pixels)
首先,您必须为 4 英寸屏幕显示添加所需的默认图像。在您的项目中正确检查是否有名称为[email protected] 的图像(640 × 1136 pixels)
This [email protected]is Necessary for Support app in 4 inch Screen display
此[email protected]对于 4 英寸屏幕显示中的支持应用程序是必需的
Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.
您将此图像添加到您的工作项目中的人,从设备或模拟器中删除旧构建,清除项目并重新构建并检查希望您的问题会解决。
Edit:-
编辑:-
After fix the black Bar issue you can check the device like my answer Give here check this:-
修复黑条问题后,您可以像我的回答一样检查设备给这里检查这个:-
you have two choice if you can't use AutoLayout
如果你不能使用,你有两个选择 AutoLayout
First
第一的
Create two xib
with same class one for 3.5 inch screen and one for 4 inch screen set using macro with checking which screen appear.
xib
使用宏创建两个具有相同级别的 3.5 英寸屏幕和一个 4 英寸屏幕设置,并检查出现哪个屏幕。
Second
第二
Set Self.view
frame using macro with checking which screen appear.
Self.view
使用宏设置框架并检查出现哪个屏幕。
There are also other methods you can use for set self.view frame as using window
frame or UIScreen
您还可以使用其他方法将 self.view 框架设置为使用window
框架或UIScreen
回答by User
My problem was I accidentally deleted the value found here:
我的问题是我不小心删除了在这里找到的值:
I added back LaunchScreen, and made sure there was a LaunchScreen.xib. Maybe it will help some others.
我重新添加了 LaunchScreen,并确保有一个 LaunchScreen.xib。也许它会帮助其他一些人。
回答by MiltsInit
Ive had the same problem - black bars at the top and bottom. It was simply solved by setting the drop down in "App Icons and Launch Images" to Main_iPhone:
我有同样的问题 - 顶部和底部的黑条。只需将“应用程序图标和启动图像”中的下拉菜单设置为 Main_iPhone 即可解决:
回答by Edwin Ikechukwu Okonkwo
This worked!
这有效!
Pay attention to Step#5 and Step#6 below:
注意下面的步骤#5和步骤#6:
1.In xcode, Click on the Project file in Project Navigator
2.Click General tab
3.Type "Main_iPhone" in the Launch Screen File field
4.Save
5.Remove the app from device or simulator
6.Then in Xcode go to Product Menu and then select Clean
7.Build again
回答by Abhijeet Sawant
I was facing same problem . I just added launch image and it worked for me.
我面临同样的问题。我刚刚添加了启动图像,它对我有用。
XCode->Click on Project File -> Select Target-> App Icons and Launch Images -> Add launch image source
XCode->点击项目文件->选择目标->应用程序图标和启动图像->添加启动图像源