I wanted to know how to make a viewcontroller
without the use of xib
or storyboard
. So in this case, I would be getting the viewcontroller
as such
PopupViewController* vc = [[PopupViewController alloc] init];
[self addChildViewController:vc];
[self.view addSubview:vc.view];
[vc didMoveToParentViewController:self];
I know it has to do something with overriding the init method since we are not using initWithCoder
?
I know I have to create a view and set it as the self.view for the PopupViewController
, but I was wondering how I could do that.
EDIT: Yes it may be much easier just to make an xib file
or add a view controller
to the storyboard
, this is to understand deeply how view controllers
work.