简体   繁体   中英

How do you disable storyboard?

我制作了一个带有Storyboard的iPhone和iPad应用程序,让我知道您是否可以在项目中禁用Storyboard,还是需要创建一个没有Storyboard的新项目。

  1. In the Summary for application Target, remove the value of the Main Storyboard and set the value for Main Interface (to specify the first nib file).

  2. You can remove the code for loading the storyboard and add code for loading your own window. you don't have to start from scratch.

Have a look at your

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

there should be some code that is creating your storyboard object (or your first object from the storyboard) and presenting it.

Presumably you have written an ios5 app that now needs to run on ios4.x?

The storyboard is fundamental to a project built around it. You would need to extract all of your scenes into separate xib files and re-link everything, plus manually code all your transitions. Much of the rest of your viewcontroller code would be ok, though.

I would recommend starting a new project and moving across from the initial view controller outward, that way you can test and compare with the original as you go.

I had an issue where I was trying to use multiple storyboards so I wanted to remove the initial storyboard and every time I tried to change it it changed back. Editing the project file and editing the project plist always seemed to get reverted.

I ended up closing xcode and manually removing the storyboard key using TextWrangler.

I reopened Xcode and the storyboard key was now gone and not giving me any issues.

I was getting very frustrated with Xcode so I hope this helps somebody.

Had the same problem. I copied part of the code from one project to another, and then I ended up seeing the storyboard of the first project in the destination project, although I had not copied it. I changed the name of the classes, then the references to the storyboard disappeared. One other suggestion was to change the location of the destination project.

see here for the link to my question

While creating a new project, you will be asked Name of the Project, Company, and below all you will have a Checkbox of Use StoryBoard . Simply de-select that. You will have default view of xib's.

There are a few reasons why you might want to disable storyboards in an iOS project. Here are three off the top of my head:

1)

you need to support an iOS version that's older than 5 (storyboards came in with iOS 5) Storyboard functionality is only supported in iOS 5 & newer, so if you want to disable it, just target anything older than 5 (eg iOS 4.3). Here's a potentially related question .

2)

you have a storyboard for much of the functionality of your app but you also want to offer additional functionality via XIB files.

3)

Too many engineers on one team messing with one storyboard file can corrupt or mess up the storyboard, so additional functionality can be added via xib files (and it's easier for one engineer to "own" -- or at least modify without colliding or losing changes within -- each xib file).

Simply delete the Storyboard from the summary for your project's target (which also appears in the Info.plist file) and replace it with a XIB file (which is the value for the " NSMainNibFile " key in the info.plist file).

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