0

此代码来自我的 AppDelegate 来自我的应用程序,它不使用故事板,并且此代码切换视图正常 -

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        LN_ShowNoteVC *showVC = [[LN_ShowNoteVC alloc] init];
        _iconBage = _iconBage - 1;
        showVC.number = _showP;
        NSLog(@"showVC.number = %i", _showP);
        _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        _window.rootViewController = showVC;
        [_window makeKeyAndVisible];
    }
}

现在,我使用 StoryBoard 重写了我的应用程序......并且这段代码不起作用......我得到黑色窗口

我如何从 AppDelegate 切换视图???

4

1 回答 1

0

This is answer)) I Get it) =)

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        LN_ShowNoteVC *showVC = [[LN_ShowNoteVC alloc] init];
        _iconBage = _iconBage - 1;
        showVC.numberPhoto = _showP;
        NSLog(@"showVC.numberPh = %i", _showP);            
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
        UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"ShowN"];
        vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        _window.rootViewController = vc;
        [_window makeKeyAndVisible];
    }
}
于 2013-04-21T19:17:56.170 回答