开发者

Navigation Within TabController

开发者 https://www.devze.com 2022-12-24 04:56 出处:网络
I am trying to use UITabController as may controller in my main window and add navigation controllers to some tab bar items.

I am trying to use UITabController as may controller in my main window and add navigation controllers to some tab bar items.

For example, the first tab has a navigation controller with table view:

alt text http://www.freeimagehosting.net/uploads/f3ad987c86.png

The SettingsViewController is associated with its own NIB file,开发者_运维技巧 where a table view is defined. Within that xib file, I have a table view and set it to the outlet of SettingsViewController class property myTableView.

Here are my h files:

// header file for SettingViewController class
@interface SettingsViewController : 
  UIViewController <UITableViewDelegate, UITableViewDataSource> {
    UITableView  *myTableView;
    // other codes vars
  }
  @property (nonatomic, retain) IBOutlet UITableView *myTableView;
  // ...
@end

// header for main app delegate
@interface MainAppDelegate : 
  NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
    // ...
  }
  @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
 // ...
@end

In my SettingsViewController.xib file, through IB, I linked outlet myTableView to the xib's file owner, ie, SettingViewController class:

alt text http://www.freeimagehosting.net/uploads/e577d35137.png

The problem is that in the main xib file, for the SettingsViewController navigation, there is one outlet myTableView. I am not sure if I have to set this to somewhere?

The exception I get is "[UIViewController _loadViewFromNibNamed:bundle:] loaded the "SettingsViewController" nib but the view outlet was not set."


SettingsViewController already has a view property. Are you sure this one is hooked up in Interface Builder? (You probably want it to be hooked up to your UITableView.)

0

精彩评论

暂无评论...
验证码 换一张
取 消