sam18
sam18

Reputation: 641

how to place a UIViewController in another UIViewController through nib in xcode

I have developed a DetailViewController, derived from UIViewController. Now I want to use this DetailViewController inside another InfoViewController's layout. I found one way to do this by using addSubView method. But what I am looking for is to plot it through nib file, like other UIViews. I want to plot DetailViewContoller inside InfoViewController's layout through nib file. Is this possible?

Any response will be thankful.

Upvotes: 1

Views: 88

Answers (1)

Sathish Kumar
Sathish Kumar

Reputation: 229

Yes it is possible..

First remove the referencing outlet for view in DetailViewController.xib.

And in InfoViewController.xib drag-drop Object and edit the custom class to DetailViewController.

Now drag-drop view in InfoViewController.xib and add what ever subviews you want to it. Now add new view referencing outlet to DetailViewController which is under objects.

Hope this will help you.

Upvotes: 1

Related Questions