0

I have an iPad app (XCode 4.6, iOS 6.2, ARC and Storyboards with a UITabController). The setup scene is the first scene displayed if required data is missing; I don't want the user to be able to leave that scene unless all required fields have valid data in them.

The only place I can think of is validating the presence of data while in -viewWillDisappear; however at that point it's too late to not change to the scene that the user tapped. It is possible for the user to tap another tab, thereby bypassing all of the existing validation.

Anybody have any ideas on how to prevent going to another scene if the required data is missing?

SpokaneDude
  • 4,856
  • 13
  • 64
  • 120

1 Answers1

0

Can you disable the button that goes to the next scene until all of the data has be entered? Have a function that checks to make sure that checks the data in all of the fields each time the fields are either edited or on editing did end. Then if there is valid data in all fields set

    [nextSceneButton setEnabled:YES]; // To toggle enabled / disabled

Or another way you could do it is to tie the button to a function that uses and if statement to check to see if all of the data is present and if all data is present then allows the segue, but if it's not then pops an error message or highlights the textfield that doesn't have valid text yet.

Steven Marlowe
  • 230
  • 2
  • 16
  • I already have checks for valid data when the user acts normally (i.e. fills in the data)... the problem is when the user does NOT enter anything, but just taps another tabBar button. I need a way to trap that tap and verify that the data is there or not. – SpokaneDude Sep 02 '13 at 16:37
  • Maybe disable to tabBar button until data has been verified? // Disable UITabBarController.tabbar.userInteractionEnabled = NO; // Enable UITabBarController.tabbar.userInteractionEnabled = YES; – Steven Marlowe Sep 02 '13 at 21:05
  • I found this [link](https://stackoverflow.com/questions/2041982/how-to-get-the-event-that-switch-tab-menu-on-iphone), implemented it and it works as I wanted. Thank you for your help... – SpokaneDude Sep 02 '13 at 17:10