简体   繁体   中英

Making two storyboards for iOS (iPhone and iPad)

Is it possible to make only one application and inside of it make two storyboards, one for iPhone and one for iPad? I don't like the idea of running the app on iPad and clicking the 2x button.

My idea was to create two storyboards and have a beginning class that would check if the device you are using is an iPhone or an iPad and then redirect to the according storyboard after. I think it is a good idea cause the code is the same.

create two different storyboards and name them so they are easily specified which is which. Then click on the file that allows you to change settings for your actual app. and change the build to universal , then specify which storyboard you want to use!

there is a storyboard setting for iphone and ipad

iPhone

在此输入图像描述

iPad

在此输入图像描述

Make sure the names of the storyboards are correctly set though

即使您已经创建了一个非通用的应用程序,只需将其更改为通用(目标 - >摘要),然后创建一个新的ipad故事板并确保在目标 - >摘要下设置主iphone故事板和主ipad故事板到正确的故事板。

Did you try creating new Universarl XCode project? If you create Universal project, there will be two Storyboards(One for iPhone and another one for iPad) created by default. i think.

I had to do this in a project recently... so first you should navigate to your projects target then click the summary button in the top bar you will then see a bar that says "iOS Application Target" in there you will see a drop down menu with a title that says Devices select the universal option. Now add a storyboard for the iPad. Now go back to the projects target and scroll down to the "iPad Deployment Info" section and set your new storyboard as the main storyboard in the text field here you can also add the iPad icon and launch images. Now you are set up for creating a universal app!

它非常简单,只需在universal执行应用程序然后转到目标然后信息然后添加主要storyborad文件基本名称(iPad)然后构建并运行iPhone运行到它的显示iPhone和iPad运行时显示为iPad兼容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM