Auto Load XIBTT20TTNavigator TTViewController XIB

I thought I wanted to share my knowledge with you around the Three20 framework.

This is annoying if you use TTNavigator and you have a custom VC that is a subclass of TTViewController. It does not load NIB automatically.

TTNavigator* navigator = [TTNavigator navigator]; TTURLMap* map = navigator.URLMap; [map from: @"app://myvc" toViewController: [MyVC class]]; 

There is a workaround and a rather elegant solution.

Just create another subclass of TTViewController and override the class:

 - (void) loadView { [super loadView]; // load automatically the NIB [[NSBundle mainBundle] loadNibNamed: NSStringFromClass([self class]) owner: self options: nil]; } 

The VC will load the NIB automatically when the VC boots for the first time.

+4
source share
1 answer

The TTNibDemo project in the samples directory has a VC that is a subclass of TTViewController. This VC has a tip, and it loads the noob with the function in AppDelegate. Check this out if this does not work for you.

+1
source

All Articles