質問

My project contains over 60 View Controllers and Xcode is very laggy when loading the storyboard.

How can I resolve this without switching to xibs? I am using Xcode 5.1 and iOS 7.x

役に立ちましたか?

解決

Problem

Putting all of your ViewControllers in one Storyboard will significantly slow down Xcode (which renders XML to show your ViewControllers) if the number of the ViewControllers is above 10. Storyboard is not the place to put all of your views, because as its name suggests a board of a specific story.

Solution

Make multiple Storyboards with 5 or 6 ViewControllers each, where you can avoid rendering hell of multiple ViewControllers. You can divide your Application on different boards named by group functionality like LoginStoryboard, UserProfileStoryboard, etc.

You can instantiate a storyboard and present a specific controller by the code below:

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Your Storyboard Name" bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"Your Controller ID"];
[self presentViewController:viewController animated:true completion:nil];

他のヒント

Keep views in more than one storyboard. It's not the problem if not every controllers are connected with segues. There is no good way to keep a large number of views in a storyboard, in addition to working on a better computer.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top