简体   繁体   English

pushviewcontroller在ios7中不起作用

[英]pushviewcontroller is not working in ios7

first time VC1 to VC2 [self.navigationController pushViewController:mainView animated:YES] is working fine. 第一次VC1到VC2 [self.navigationController pushViewController:mainView animation:YES]工作正常。 From VC2 to VC3 is not working in ios7. 从VC2到VC3在ios7中不起作用。

VC1->VC2 (working fine) VC1-> VC2(工作正常)

- (IBAction)loginBtnAction:(id)sender
{

    GVMainViewController *mainView;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPhone" bundle:nil];
    } else
    {
        mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPad" bundle:nil] ;
    }

    [self.navigationController pushViewController:mainView animated:YES];
}

VC2->VC3 (NOt working) VC2-> VC3(无效)

- (IBAction)doneButtonAction:(id)sender
{
    [[FinishViewController getsharedInstance]updateProfileInfo];
    [self performSelector:@selector(moveTo) withObject:nil afterDelay:0.5];

}

- (void)moveTo
{
    GVMainViewController *mainView;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPhone" bundle:nil];

    } else
    {
        mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPad" bundle:nil] ;
    }

    [self.navigationController pushViewController:mainView animated:YES];
}

and also getting some log Finishing up a navigation transition in an unexpected state. 并获得一些日志在意外状态下完成导航过渡。 Navigation Bar subview tree might get corrupted. 导航栏子视图树可能已损坏。 in all iOS versions, But In ios7 it is not pushing the view controller. 在所有iOS版本中,但是在ios7中,它没有推送视图控制器。

Please any one tell me the solution clearly for iOS7 and lower versions. 请任何人清楚地告诉我针对iOS7及更低版本的解决方案。 Thanks in Advance. 提前致谢。

mainView should be pushed on main thread as performSelector initiates background thread. 当performSelector启动后台线程时,应将mainView推入主线程。

- (void)moveTo
{
    GVMainViewController *mainView;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
         mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPhone" bundle:nil];

    } 
    else
    {
        mainView = [[GVMainViewController alloc] initWithNibName:@"GVMainViewController_iPad" bundle:nil] ;
    }

    dispatch_async(dispatch_get_main_queue(), ^{
        [self.navigationController pushViewController:mainView animated:YES];
    });
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM