1

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.

3
  • Add some code here so that people will be able to you more easily.
    – Yogesh
    Dec 9, 2013 at 15:22
  • 1
    mmmmmmm it's really difficult to answer you like this, this seems like a wide range problem, so many things could be the issue, it would really help if you can show us a github repo that would show us the problem @GustavoAzOI
    – Nour Helmi
    Dec 9, 2013 at 15:30
  • 3
    pushing second controller before the first view is appeared is likely to cause problem, I once did a project like this and it caused a lot of pain - The navigation tree was a messy, sometimes it works some times it doesn't. I would suggest determine which controller to go before pushing next view controller, you can use multiple segues to control where to go. Dec 9, 2013 at 15:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.