0

I think many developer have tried this, how to make MainStoryBoard to load many UIViewController with xib or use NIB method, there is the explaination :

  1. I have one MainStoryBoard and connected with class ViewController that use UIViewController
  2. I have LoginViewController, HomeViewController also each .xib file
  3. The problem is i want separate each logical code at each controller but i addSubview to MainStoryBoard exp: LoginViewController.xib the logical at LoginViewController.swift from there i want got to HomeViewController when loged in ...can anyone solve that's problem ?
iOS Developer
  • 138
  • 2
  • 18
alpiopio
  • 243
  • 1
  • 2
  • 10
  • 1
    Possible duplicate of [Xcode Storyboard and xib connection](http://stackoverflow.com/questions/15567833/xcode-storyboard-and-xib-connection) – Badal Shah Jan 29 '16 at 08:31

1 Answers1

0

You need to override the initWithCoder method in the object-c class.

     if ((self = [super initWithCoder:aDecoder])) {
        [self addSubview:[[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] objectAtIndex:0]];
    }
    return self;
}

For more detail follow this link

Add subview from a xib or another scene with storyboard

Community
  • 1
  • 1
Badal Shah
  • 7,541
  • 2
  • 30
  • 65