Iphone 使用xcode 4在ios 5中创建选项卡式导航应用程序时出现问题
我正在尝试更改xcode 4上的一个选项卡式应用程序,以合并一个不带故事板的导航控制器。 第一个选项卡包含一个表。这是一个需要通航的 这是FirstViewController.hIphone 使用xcode 4在ios 5中创建选项卡式导航应用程序时出现问题,iphone,objective-c,ios,xcode,tabbed-view,Iphone,Objective C,Ios,Xcode,Tabbed View,我正在尝试更改xcode 4上的一个选项卡式应用程序,以合并一个不带故事板的导航控制器。 第一个选项卡包含一个表。这是一个需要通航的 这是FirstViewController.h #import <UIKit/UIKit.h> @interface FirstViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { IBOutlet UITableView
#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
现在,当我构建并运行它时,我看到两个选项卡。但是第一个选项卡只是一个空白的黑屏,描绘了导航控制器,但是没有应该有的tableview
我错过了什么吗
谢谢..在您的代码中,我看不到您正在初始化FirstViewController类并让NavController知道它。NavController需要使用RootViewController初始化,如:
NavController *myNavController = [[NavController alloc] initWithRootViewController:yourFirstViewController];
查找更多信息的好地方是:
#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
#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;
}
NavController *myNavController = [[NavController alloc] initWithRootViewController:yourFirstViewController];