本文介绍了为什么我不能从didFinishLaunchingWithOptions启动这个模态视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试做一些非常简单的事情,据我估计:
I am trying to do something pretty easy, in my estimation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
prefs = [NSUserDefaults standardUserDefaults];
BOOL IsLoggedIn = [prefs boolForKey:@"IsLoggedIn"];
if(IsLoggedIn == NO)
{
//Show login controller
LoginViewController *lvc = [[LoginViewController alloc] initWithNibName:nil bundle:nil];
[self.tabBarController presentModalViewController:lvc animated:NO];
[lvc release];
}
else if(IsLoggedIn == YES)
{
//Continue doing crap
}
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
NSArray *tabs = self.tabBarController.viewControllers;
UIViewController *tbInvoice = [tabs objectAtIndex:0];
tbInvoice.tabBarItem.image = [UIImage imageNamed:@"Open-Mail.png"];
UIViewController *tbClient = [tabs objectAtIndex:1];
tbClient.tabBarItem.image = [UIImage imageNamed:@"Breifcase.png"];
[self.window makeKeyAndVisible];
return YES;
}
使用调试器时,我看到它输入 if (IsLoggedIn == NO)
并运行 LoginViewController
代码,但视图从不显示。
When using the debugger, I see it enter if(IsLoggedIn == NO)
and run the LoginViewController
code, but the view never shows.
这让我发疯了。
我尝试在之后运行代码[self。 windoow makeKeyAndVisible]
,但它没有改变任何东西。
I tried running the code after [self.windoow makeKeyAndVisible]
, but it didn't change anything.
这段代码看起来就像我见过的每个例子。谁能看到我做错了什么?
This code looks like every example I've seen. Can anyone see what I'm doing wrong?
提前致谢,
Clif
推荐答案
Hpoe this 会给你一些想法。
Hpoe this post will give you some idea.
这篇关于为什么我不能从didFinishLaunchingWithOptions启动这个模态视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!