0
votes

I have a Tab bar Controller with 4 tabbar. i have subclass tab bar controller and added a UIView on the view of tab bar controller. and i wanted to add a view controller inside the UIView as subview or child view controller. i have acheave this by

let nvc : UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "SongDetailVC") as! SongDetailsVC

nvc.willMove(toParentViewController: self)
playerMainView.addSubview(nvc.view)
self.addChildViewController(nvc)
nvc.didMove(toParentViewController: self)

But the problem is, using this code i am only able to add the view of the SongDetailVC. though i want to add the navigation bar as well.

i have tried embedding SongDetailVC into a navigation controller. i i am unable to get the navigation bar.

is there any way of achieving this. ?

1

1 Answers

0
votes

If your SongDetailVC is embedded in a UINavigationController, and you want the UINavigationController also, then you will need to instantiate the UINavigationController. Make sure to set the identifier in the storyboard.