我正在尝试在iPhone应用程序中设置不同的启动画面.xib
文件。
我想知道有什么方法可以在iPad版和iPhone版中设置不同的启动屏幕文件。就像Xcode允许iPad / iPhone的不同故事板一样。我认为必须有一个选择。
看一下屏幕截图。
答案 0 :(得分:10)
I created two storyboard files for example: LaunchScreen_iPhone.storyboard and LaunchScreen_iPad.storyboard. Doesn't have to be those exact names. The file names are referenced from the Info.plist file.
In the Info.plist file edit the "Launch screen interface file base name" (UILaunchStoryboardName) key value to "LaunchScreen_iPhone"
Create another key-value entry in the Info.plist in the key name "UILaunchStoryboardName~ipad" and value "LaunchScreen_iPad"
答案 1 :(得分:9)
In the Info.plist file, create another entry called UILaunchStoryboardName~ipad
and set it to your LaunchScreeniPad.xib
答案 2 :(得分:6)
创建两个名为
的.xib文件LaunchScreen2〜iphone.xib
LaunchScreen2〜ipad.xib
答案 3 :(得分:0)
You can also use storyboard based Launchscreen and make device dependent layout in one file.
Layout your launchscreen for iphone with size classes (w: Any, h: Any)
, then change size classes to w: Regular, h: Regular
and layout it again for iPad by uninstalling conflicting views/constraints and installing new.
You can read more about adaptive layout here: https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started
I believe this is recommended approach since Apple introduced features like Split View. That way you can launch your app on iPad but with screen size of iPhone.