Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding a viewControllers view to another viewController

I am completely new to iPhone development. I have two ViewControllers

  1. ViewControllerA
  2. ViewControllerB

ViewControllerA is the first one and launches with the app.

I have another ViewControllerB now I want to add view of ViewControllerB as subview to ViewControllerA's view when application launches.

like image 809
Ankit Sachan Avatar asked Dec 13 '22 15:12

Ankit Sachan


2 Answers

Try this

ViewControllerB *vcb = [[ViewControllerB alloc] init];

[self.view addSubview:vcb.view];
like image 56
visakh7 Avatar answered Dec 15 '22 04:12

visakh7


A belated answer. I just wrote some words about my solution for this question. It can be found here: http://blog.nguyenthanhnhon.info/2014/04/how-to-add-viewcontrollernavigationcont.html

like image 33
Thanh-Nhon Nguyen Avatar answered Dec 15 '22 04:12

Thanh-Nhon Nguyen