JayVDiyk
JayVDiyk

Reputation: 4487

Load UITabBarController from Nib

How do we load a UITabBarController from NIB?

for UIViewControllers we could easily do this

        let viewController = SubclassOfViewController(nibName: "SubclassOfAViewController", bundle: nil);

But I could not find any similar method to load a UITabBarController which is from Nib

Any thoughts?

Thank you

Edit: I am not using Storyboards

Upvotes: 0

Views: 327

Answers (1)

Rajesh
Rajesh

Reputation: 10424

If you are using storyboard

 let tabbarController = [[UIStoryboard storyboardWithName:@"Main"bundle:NULL] instantiateViewControllerWithIdentifier:@"SubclassOfAViewController"]; 

where SubclassOfAViewController is identifier.

Else

let viewController = SubclassOfViewController(nibName: "SubclassOfAViewController", bundle: nil)

This method is fine. Since UITabbarController is a subclass of UIViewController there is no need of separate method here in subclass

Upvotes: 1

Related Questions