0

Any reason why this is not permitted in Xib.

-(void)addLeftViewController:(UIViewController *)viewController
{
    [self addChildViewController:viewController];
    [viewController.view setFrame:CGRectMake(0, 0, self.leftVw.frame.size.width, self.leftVw.frame.size.height)];
    [self.leftVw addSubview:viewController.view];
    [viewController didMoveToParentViewController:self];
}
SanjayPathak
  • 121
  • 1
  • 10

2 Answers2

1

You can easily do that in the storyboard, by using the container view: enter image description here

almas
  • 6,644
  • 6
  • 30
  • 46
  • Thanks @almas for pointing that to me, but while adding that container my Xcode 6.4 crashed and then containerView itself is not coming on my Xcode, any idea how can i get that in future? – SanjayPathak Jul 08 '15 at 18:38
  • Got the problem. Container View is only applicable to storyboard. I was searching it while I opened Xib. – SanjayPathak Jul 09 '15 at 04:53
0

I found this link helpful

How to add a subview that has its own UIViewController in Objective-C?

Community
  • 1
  • 1
SanjayPathak
  • 121
  • 1
  • 10