Kevin Sylvestre
Kevin Sylvestre

Reputation: 38062

Modal Tab Bar ViewController

I need to present a modal tab bar controller using interface builder. I'd like to be able to specify and design the tab bar controller in a InfoViewController.xib file, then present it from a variety of locations within the application using something like:

UIViewController *vc = [InfoViewController create];
[self presentModalViewController:vc animated:YES];

I don't know how to setup the interface builder file. I can drag in a tab bar view controller, but it is not displayed when the view controller is presented. How should I link up this tab bar controller with the file owner?

Upvotes: 1

Views: 924

Answers (3)

Shaggy Frog
Shaggy Frog

Reputation: 27601

Interface Builder is for designing your views.

You choose how and when to present them (e.g. modally) inside your code.

Upvotes: 1

Kevin Sylvestre
Kevin Sylvestre

Reputation: 38062

I ended up defining the tab bar controller in each XIB it was being presented from (currently only one). Not the ideal situation, but could not figure out how to do it from an external reusable XIB.

Upvotes: 0

W Dyson
W Dyson

Reputation: 4634

You're over thinking this. Just do exactly what you said you were going to do. Reusability is a good thing.

Upvotes: 1

Related Questions