【问题标题】:ModalViewController only displays if animatedModalViewController 仅在动画时显示
【发布时间】:2011-06-30 14:56:31
【问题描述】:

在我的应用委托中,我想为应用首次启动显示一个注册屏幕。

这是我的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.rootViewController = self.tabBarController;
[[[self.tabBarController.tabBar items] objectAtIndex:2] setEnabled:NO];    
[[[self.tabBarController.tabBar items] objectAtIndex:3] setEnabled:NO]; 

if (![self checkAuth]) {
    SignupViewController * signUp = [[SignupViewController alloc] initWithNibName:@"SignupView" bundle:nil] ;
    [signUp setManagedObjectContext:self.managedObjectContext];
    [[self tabBarController] presentModalViewController:signUp animated:YES] ;
    [signUp release] ;
}
[self.window makeKeyAndVisible];
return YES;}

一切正常,但我不希望我的 modalViewController 被动画化......

当我换行时:

[[self tabBarController] presentModalViewController:signUp animated:YES] ;

为:

[[self tabBarController] presentModalViewController:signUp animated:NO] ;

我的底层 tabBarController 显示了,我的 modalViewController 没有出现!

我花了很多时间搜索有类似问题的人,但我没有找到任何解决方案......

有人可以帮助我吗?

【问题讨论】:

    标签: iphone ios4 delegates xcode4 modalviewcontroller


    【解决方案1】:

    尝试在 presentModalViewController 之前调用[self.window makeKeyAndVisible];

    【讨论】:

    • 我想在动画==YES 的情况下,在显示 modalView 时会有一点延迟,这会使窗口在真正添加 modalView 之前可见。如果 animated==NO modalView 将被添加而窗口不可见并被忽略。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-02
    • 1970-01-01
    • 1970-01-01
    • 2020-04-28
    • 2017-11-10
    • 2020-07-15
    • 2019-09-07
    相关资源
    最近更新 更多