简体   繁体   English

从应用程序委托呈现模式视图不平衡的调用以开始/结束外观

[英]presenting modal view from app delegate unbalanced calls to begin/end appearance

This is the code I'm using to present a modal view when the app first starts 这是我在应用程序首次启动时用于呈现模式视图的代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];


Security *security = [[Security alloc] initWithNibName:@"Security" bundle:nil];
[self.tabBarController.selectedViewController presentModalViewController:security animated:YES];
[security release];

return YES;

} }

This is what the log says 这就是日志所说的

Unbalanced calls to begin/end appearance transitions for <UITabBarController: 0x171320>.

Is there a better way to achieve this? 有没有更好的方法来实现这一目标?

Also I have this method in my app delegate 我的应用程序委托中也有这种方法

    -(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {

    if (viewController == [tabBarController.viewControllers objectAtIndex:2]) {

        //The Log Out tab locks the app by presenting a modalviewcontroller that can't be dismissed unless there is a password.
        Security *security = [[Security alloc] initWithNibName:@"Security" bundle:nil];
        [self.tabBarController presentModalViewController:security animated:YES];
        [security release];
        return NO;

    } else {

    return YES;
    }
}

Basically one of the options on my tabbarcontroller is a logout button. 基本上,我的tabbarcontroller上的选项之一是注销按钮。 The above code works fine and doesn't throw a warning to the log. 上面的代码可以正常工作,并且不会向日志发出警告。

Why are you presenting it from your tab bar controller? 为什么要从标签栏控制器中显示它? Assuming your above code is from a UIViewController, try 假设上面的代码来自UIViewController,请尝试

[self presentModalViewController:security animated:YES];

or 要么

[self.navigationController presentModalViewController:security animated:YES];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Storyboard在XCode 4中以模态方式推送视图时出现“开始/结束外观转换的不平衡调用”警告 - “Unbalanced calls to begin/end appearance transitions” warning when push a view in a modal way in XCode 4 with Storyboard 开始/结束外观转换的呼叫不平衡 - Unbalanced calls to begin/end appearance transitions 对UITabBarController的开始/结束外观转换的不平衡调用 - Unbalanced calls to begin/end appearance transitions for UITabBarController 不平衡的调用以开始/结束UIViewController的外观转换 - Unbalanced calls to begin/end appearance transitions for UIViewController 使用MediaPicker的开始/结束外观转换的不平衡调用 - Unbalanced calls to begin/end appearance transitions for Using MediaPicker XCODE:不平衡的调用以开始/结束外观转换 - XCODE: Unbalanced calls to begin/end appearance transitions for <UIFileUploadFallbackRootViewController 呼叫开始/结束状态转换的不平衡呼叫 <ViewController> , <Tab> - Unbalanced calls to begin/end appearance transitions for <ViewController>,<Tab> 不平衡的调用以开始/结束外观转换(我相信这与UINavigationController相关) - Unbalanced calls to begin/end appearance transitions for (I believe this is UINavigationController related) 对开始/结束外观转换的不平衡调用<UINavigationController: 0xa98e050> - Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0xa98e050> 呼叫开始/结束状态转换的不平衡呼叫<GKModalRootViewController: 0xb7e450> - Unbalanced calls to begin/end appearance transitions for <GKModalRootViewController: 0xb7e450>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM