I have a project where I have, among other screens, a History screen, a ChooseProfile screen and a Register New Profile screen.
If the user enters the History and don't have a profile selected, he must be redirect do the ChooseProfile and then return to the History with the profile. Also, in the ChooseProfile screen, if it has no profiles yet, he must be redirect to the Register New Profile screen.
The user must not see all the transitions of the screen. When he chooses to enter History, he must only see the transition to the final screen (for example, if a have no profile and click to go to History, I must see the transition to the Register New Profile, so I can fill my data and when click in OK, go back to history with a valid profile - not even seeing the ChooseProfile between).
I could achieve this, in iOS 6, by performing the segues (or making pushes) in the viewWillAppear of the controller, and everything looked fine. But in iOS 7 I'm having strange effects. For example, sometimes the screen freezes in the first controller (History) and, even if the app doesn't crash, everything seems disable.
In the debug, it seems like he is pushing the other controllers, but the screen (view) isn't changing.
Someone could help me with a solution? I don't want to rework all my flow to solve this...
Thanks.
Here some partes of the code. Hope it helps.
In the HomeController (the root):
- (IBAction)historyBtnPressed:(UIButton *)sender {
UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"HistoryController"];
[self.navigationController pushViewController:vc animated:NO];
}
In the History Controller:
-(void)viewWillAppear:(BOOL)animated {
[_tableView reloadData];
if(!_profile)
[self selectProfilePressed:nil];
}
- (IBAction)selectProfilePressed:(UIButton *)sender {
[self performSegueWithIdentifier:@"ProfileListSegue" sender:nil];
}
If, in the first code block, I left the animated:NO, it works fine, but I have no transition effect, even with the segue in the second controller. The screen (ProfileList) simply appears.
If I set it to animated:YES in first code block, my navigation stack seems to get messy.