我有一个tabBarApplication,我有作为有每个选项卡上UINavigation模板的模板。建立在一个UIViewController一个UINavigation控制器rootView
我想使用的样品(那种),并将其转换成一个单一的UIViewController在诺特尔应用。我已经提交了两段代码,第一段是我的模板,而后者是我正在做的。任何人都可以给我一些提示或帮助如何做到这一点?我不断收到错误,但它们对我来说没有意义,因为tabBarApp不需要声明viewController。
第一个代码(例子):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self setupFetchedResultsController];
if (![[self.fetchedResultsController fetchedObjects] count] > 0) {
NSLog(@"!!!!! ~~> There's nothing in the database so defaults will be inserted");
[self importCoreDataDefaultRoles];
}
else {
NSLog(@"There's stuff in the database so skipping the import of default data");
}
// The Tab Bar
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
// The Two Navigation Controllers attached to the Tab Bar (At Tab Bar Indexes 0 and 1)
UINavigationController *personsTVCnav = [[tabBarController viewControllers] objectAtIndex:0];
UINavigationController *rolesTVCnav = [[tabBarController viewControllers] objectAtIndex:1];
return YES;
}
第二个代码(我试图做):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self setupFetchedResultsController];
if (![[self.fetchedResultsController fetchedObjects] count] > 0) {
NSLog(@"!!!!! ~~> There's nothing in the database so defaults will be inserted");
[self importCoreDataDefaultRoles];
}
else {
UIViewController *mainViewController = (UIViewController *)self.window.rootViewController;
UINavigationController *readingsTVCnav = [[mainViewController viewController] objectAtIndex:0];
// Override point for customization after application launch.
return YES;
}
代码的取件都涉及到其已设定核心数据起来和工作。 这样做的原因的变化是,我想有设置为初始画面,而不是tabBarConfiguration的平面图控制器。
干杯杰夫
编辑:我添加了图像的清晰度
我不清楚你的新的导航将如何工作。你的初始视图控制器会成为导航控制器吗? – jonkroll 2012-04-09 23:05:52
是的,我正在使用故事板,并且在UINavigation控制器中嵌入了ViewController。 – 2012-04-09 23:12:14
嵌入式ViewController中有什么?你将如何导航到你的应用程序的其他部分? – jonkroll 2012-04-09 23:17:41