Reputation: 2867
first time VC1 to VC2 [self.navigationController pushViewController:mainView animated:YES] is working fine. From VC2 to VC3 is not working in ios7.
VC1->VC2 (working fine)
- (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)
- (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.
Please any one tell me the solution clearly for iOS7 and lower versions. Thanks in Advance.
Upvotes: 2
Views: 4623
Reputation: 4380
mainView should be pushed on main thread as performSelector initiates background thread.
- (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];
});
}
Upvotes: 4