2012-04-21 97 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。

有什么我错过了什么?

谢谢..

回答