I have a start.storyboard file that contains two basic view controllers. I also have my main.storyboard file that contains a tab bar view controller. While I see the benefit of using storyboard references, my question is if I can go the other way. Can I combine the start.storyboard and main.storyboard files, much like how I can go the other way with Refactor to Storyboard. I have included a screenshot of each storyboard below.
Per Pierre Perrin: "The easiest way is to select your viewControllers, copy and paste in you main.storyboard." Regarding the swift files associated with the view controllers and whether or not you will need to update the class references in the identity inspector, "normally it will be done automatically. The segues are related with the viewController and not with the Storyboard."
Related
The answer I found after a week
I am trying to copy a storyboard's cell to another cell and it succeeds. Then I thought if it would work if I copied the viewcontroller directly to another storyboard, the answer is yes. I am very sorry that I can't upload the image details.
This is the step:
1、Select View Controller Scene in the storyboard and copy it.
2、To another storyboard you need to move to, paste
3、Delete the View Controller Scene in the storyboard in the first step.
If you have other answers, please give me the answer, thank you very much.
The following is my original question
Before the storyboard didn't divide the business, many different business pages were in a storyboard, and now I want to group them out. Grouped into multiple storyboards by business, just like folder grouping.
Example:
A.storyboard contains a.viewcontroller, b.viewcontroller, c.viewcontroller, d.viewcontroller
Because of business needs, you need to group a.viewcontroller, b.viewcontroller to B.storyboard.
Some methods
I noticed a feature of Xcode, Editor -> Refactor to Storyboard, which narrows the selected viewcontroller to a reference tag and points to another Storyboard. But this can only be done by grouping a viewcontroller into a Storyboard. It is not possible to group multiple viewcontrollers into a Storyboard.
So can I group multiple viewcontrollers in the current Storyboard to another Storyboard? Do you need to start with Source Code? If you know the method, please let me know, thank you very much.
Yes you can.
This is a good way to write codes.
group multiple viewcontrollers in the Storyboard
I'm trying to use this repository from Github and to use it you must have a xib file whether it's in your storyboard or not and I wanted to know how I can do to have my view controllers acting like xib but in my storyboard.
I'm sorry if I'm not clear enough but just tell me in the comments and I'll try my best to be clearer.
Kindest regards,
All you have to do is in your project select New File from the file menu or by right clicking in your file navigator. On the popupWindow select iOS on the left (This will let you see all the options) find the "View Option".
and this will create a View.Xib file. This is just the UI file for a view.
Situation: two UITabBarController's, each with their own tabs, but last tab in both is identical so want one UIViewController to show content.
Issue at runtime: Shared item only appears in one of the tab sets when shown.
Question: anyone know a way to make this work?
Link to external graphic of storyboard setup: (sorry, don't have enough reputation to post images here!)
Storyboard graphic
An Xcode project with that storyboard:
XCode Project
Each tab content item has it's own UIViewController class. They contain no code except the line to make the back buttons work.
(Yes, I know this is odd. Real situation is an iPad app where tab controllers are shown in popovers; popovers are "property editors" where different objects have different properties, but all share a common set of properties... thus one tab for "unique" props, one shared tab content for the "common" props all objects have.)
I've found a couple ways around this to get the effect I want, but if this storyboard worked it would be a much easier solution.
-- Other info, somewhat unrelated to question --
Alternate solution I'm using: TabBarControllers only link to one VC as tab content. When that tab VC loads, I use code to (a) instantiate shared VC from storyboard by identifier, (b) add that new VC object to the TabBarController via [tabController setViewControllers:list animated:NO].
(Another possible solution I like even less: not using a TabBarController, and presenting content VC's with my own "tab" graphic drawn into them, each showing "myself" as selected. Yuk.)
So I have a working solution, I'm just curious as to why this doesn't work (just a known thing in iOS API, or some magical property setting that might render it functional?)
You can't put the same view controller instance into two tab controllers. The problem is that a view (UIView) instance can only have one parent view (superview). When you try to add the view controller to the 2nd tab, the view controller's view gets removed from its first parent (the first tab) and then added to the 2nd tab.
I stumbled upon your thread while running into the same issue today...
The solution is to just make a duplicate of the view controller in story board and attach the duplicate to the other tab bar controller.
I just did it and it works...
I think the 'rdelmar' is right about this... copy it and set it ..!!
I ran across this same issue today. I managed to come up with a workaround that seems to do the trick. The key is to add a layer of separation between the tabbar and the controller you want to reuse. From each tabbar, I created a relationship to a distinct UIViewController with a container view. Then you can do an 'embed' segue from the container to the controller you actually want to reuse as the tab view. It is not quite as clean as a direct connection (not sure why that is not supported) since you do have to create a controller class for each reuse case. It is still a better solution than the nightmare of having to duplicate the actual tab view ( as well as any additional views that connect to it) for every use.
Hope this helps. Let me know if anyone needs more details.
I think using storyboard will save us a lot of work sometimes. But when more than one mates working on the same storyboard. Is it possible that conflicts occurs frequently? When using .xib I and my workmates will have conflicts when we are working on the same .xib. So how about the storyboard? BTW:Don't tell me to use more than one storyboard. I think I prefer xib than storyboard if I need to use more than one storyboard.
If you have one big storyboard for your app, and several developers on your team will need to make changes in the storyboard, you will probably get conflicts.
If you're using xibs, you can put unrelated views in separate xibs. Then when developer A needs to change something in view 1, he just changes the xib containing view 1. And at the same time, if developer B changes something in view 2, he changes the xib containing view 2, which is probably separate from the xib containing view 1. So you don't get a conflict.
If you're using a storyboard, all the views are in one file. So developer A changes the storyboard to modify view 1, and at the same time developer B changes the storyboard to modify view 2. Boom, you get a conflict.
If your team has multiple developers working on the app user interface, you are much more likely to get conflicts if you use storyboards than if you use (carefully-separated) xibs. This is a serious problem with storyboards.
However, you can't create a table view controller with static content in a xib. You can only do that in a storyboard. So sometimes it's worthwhile to create a storyboard containing just one table view controller, in a project that uses xibs for everything else.
I've reviewed many websites and youtube videos that have IOS 5 storyboarding information. Most of them are pretty basic and only describe how to get started with storyboarding and how to segue into other views. I'm interested in taking it a step further and actually adding custom code to the views contained within the storyboard.
Is the "normal" workflow when creating an IOS app using storyboard?
Create the layout of an app using storyboard (adding views and objects to those views).
Create viewcontroller files (.h and .m), one for each view contained within the storyboard.
Hook up the scenes from the storyboard with your own view controller subclasses by editing the "class" values in Identity Inspector.
I believe I followed those steps, but when I implemented step #3 above and ran my application, I was only able to see a black screen. The view I had created in storyboard wouldn't display.
You have the right steps. Make sure you create your .m and .h without a xib. Post your code for the view controller for your first view to get more help.
yes, this is the normal workflow. have you set the "initial viewcontroller? ?
see this image: http://dl.dropbox.com/u/31437518/Screen%20Shot%202012-01-24%20at%2012.29.34%20AM.png
It sounds like you made a storyboard file but it isn't being loaded.
Do you have the main storyboard setting in the target summary screen filled in?