I'm creating an app using tab bar controller. It has 2 tabs. In first tab, it will have a text field and a submit button. user will enter some value in text field and clicks submit. Now my problem: on click of submit button, some result "X" is computed depending on value entered in text field and it will open second tab. here result "X" has to be shown in label. without entering some value in text field, if user clicks on second tab, it must show an alert that "enter some value in text field" How can i achieve this. please help me.
A:
You should implement the UITabBarControllerDelegate methods, such as – tabBarController:shouldSelectViewController:. The method is used to determine if it is allows to switch to another view while a user is tapping on a tab bar item. For instance, if you do not want the user to switch to tap 2, just return "NO" and present an alert view.
zonble
2010-03-31 17:19:34