[英]Different versions of app for different devices - iPhone to iPad
I'd like to take my existing iPhone app and modify its layout/number of screens for an iPad.我想使用我现有的 iPhone 应用程序并为 iPad 修改其布局/屏幕数量。
I began by duplicating the Target with "Duplicate and Transition to iPad".我首先使用“复制并过渡到 iPad”来复制目标。
But I'm unsure where to go after that.但我不确定在那之后 go 在哪里。 I'll need a new Storyboard and some of the functions/viewControllers/views will need to be modified.
我需要一个新的 Storyboard 并且需要修改一些函数/viewControllers/views。 Where/how do I do that?
我在哪里/如何做到这一点?
All I can find are very old solutions that are no longer valid or leave too much out:我能找到的只是非常旧的解决方案,它们不再有效或遗漏了太多:
How to convert iPhone app to iPad app 如何将 iPhone 应用程序转换为 iPad 应用程序
This is the best one I've found, but again not current and still leaves a lot out:这是我找到的最好的,但又不是最新的,仍然遗漏了很多:
http://innovationm.co/convert-iphone-application-to-universal-application/ http://innovationm.co/convert-iphone-application-to-universal-application/
I no longer see a "Universal" option.我不再看到“通用”选项。 I am guessing that selecting all of these accomplish the same thing?
我猜选择所有这些可以完成同样的事情?
First, edit your target to make sure it is set for both iPhone and iPad:首先,编辑您的目标以确保它同时适用于 iPhone 和 iPad:
Second, using two different storyboards is unusual nowadays, but you can easily do it.其次,现在使用两个不同的故事板是不寻常的,但你可以很容易地做到这一点。 In your Info.plist configure two entries (using Raw Keys and Values):
UIMainStoryboardFile
and UIMainStoryboardFile~ipad
.在Info.plist 中配置两个条目(使用原始键和值):
UIMainStoryboardFile
和UIMainStoryboardFile~ipad
。 The result is that your app will load one storyboard for an iPhone and a different storyboard for an iPad.结果是,您的应用将为 iPhone 加载一个 storyboard,为 iPad 加载不同的 storyboard。
Note that with a newer created project that uses window scenes under iOS 13 and later, you would configure UIApplicationSceneManifest
and UIApplicationSceneManifest~ipad
to specify different UISceneStoryboardFile
values.请注意,对于使用 iOS 13 及更高版本下的 window 场景的较新创建项目,您将配置
UIApplicationSceneManifest
和UIApplicationSceneManifest~ipad
以指定不同UISceneStoryboardFile
值。
Here's a downloadable project that demonstrates the newer structure:这是一个演示新结构的可下载项目:
https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/bk1ch09p358universal https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/bk1ch09p358universal
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.