2012-04-21 94 views
2

我試圖改變的Xcode 4一個標籤應用到包括導航控制器沒有故事板創建在iOS 5中一個標籤式導航應用。 1st選項卡包含一個表格。這是需要導航的那個。問題在和Xcode 4

這裏是FirstViewController.h

#import <UIKit/UIKit.h> 

@interface FirstViewController : UIViewController <UITableViewDelegate,  UITableViewDataSource> { 
IBOutlet UITableView *storeDetailsTable; 
} 

@property (nonatomic, retain) UITableView *storeDetailsTable; 
@property (nonatomic, strong) NSDictionary *resultData; 
@property (nonatomic, strong) NSMutableArray *populatedStoreArray; 
@property (nonatomic, strong) NSMutableArray *images; 


@end 

這裏的NavController.h:

#import <UIKit/UIKit.h> 

    @interface NavController : UINavigationController 

    @property (nonatomic,retain) IBOutlet UINavigationController * navController; 

    @end 

所以,我用NavController作爲UIViewControllerSubclass,然後將其改爲以上。

的AppDelegate.h:

#import <UIKit/UIKit.h> 
@class NavController; 

@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate> { 
    IBOutlet NavController *navController; 
} 

@property (strong, nonatomic) UIWindow *window; 
@property (strong, nonatomic) UITabBarController *tabBarController; 
@property (strong, nonatomic) IBOutlet NavController *navController; 

@end 

而且AppDelegate.m:

#import "AppDelegate.h" 
#import "FirstViewController.h" 
#import "SecondViewController.h" 
#import "NavController.h" 

@implementation AppDelegate 

@synthesize window = _window; 
@synthesize tabBarController = _tabBarController; 
@synthesize navController; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    // Override point for customization after application launch. 
    navController = [[NavController alloc] initWithNibName:@"NavController" bundle:nil]; 
//  UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil]; 
    UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 
    self.tabBarController = [[UITabBarController alloc] init]; 
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:navController, viewController2, nil]; 
    self.window.rootViewController = self.tabBarController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

現在,當我建立並運行它,我看到2個標籤。但第一個標籤只是一個空白的黑色屏幕,描述了導航控制器,但沒有應該顯示的tableview。

有什麼我錯過了什麼?

謝謝..

回答