How to use MainStoryBoard to load and change UIViewController [IOS] -


i think many developer have tried this, how make mainstoryboard load many uiviewcontroller xib or use nib method, there explaination :

  1. i have 1 mainstoryboard , connected class viewcontroller use uiviewcontroller
  2. i have loginviewcontroller, homeviewcontroller each .xib file
  3. the problem want separate each logical code @ each controller addsubview mainstoryboard exp: loginviewcontroller.xib logical @ loginviewcontroller.swift there want got homeviewcontroller when loged in ...can solve that's problem ?

you need override initwithcoder method in 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 link

add subview xib or scene storyboard


Comments