我有一個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