A
A
Anton B2015-06-29 12:58:50
iOS
Anton B, 2015-06-29 12:58:50

How to export view from storyboard?

Good afternoon!
I am doing a project in which there will be about 30 views with various interactions between each other.
I thought that it would be convenient for me to create a temporary project, create a view, a controller and a model for it in it, test everything, and then add it all to the main project. And now I'm wondering how to do it, tell me please. It is clear how to transfer controller and model files, but how to transfer view from storyboard is not clear, only reassemble in the main project?
What is the right thing to do in such a case? Conservatives recommend not using a storyboard at all, how relevant is this in mid-2015?
Thanks for answers.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
An, 2015-06-29
@bigton

If we are talking about the view-shka of that same controller, then transfer everything along with the storyboard. Just rename it (by default, it’s like main.storyboard goes there so that there are no conflicts with what you will already have in the project)
Well, then we load the desired viewcontroller all the same.
We get an instance of the storyboard via
https://developer.apple.com/library /ios/documentat...
Load the required viewcontroller from it via
https://developer.apple.com/library/ios/documentat...

M
ManWithBear, 2015-06-29
@ManWithBear

Create a new xib containing only your view.

+ (instancetype)createMyView {
    UIViewController *dvc = [UIViewController new];
    MyView *myView = [[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:dvc options:nil] firstObject];
    return myView;
}

P
Petrushka, 2015-06-29
@petruska

you can just COPY / PAST controller

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question