Reputation: 453
I have the following code in my custom method:
(IBAction)checkContinue:(UIButton *)sender {
if ([category.text isEqualToString:@""])
{
[self displayErrorMsg:@"Category Name cannot be empty"];
[category becomeFirstResponder];
}
//The else part doesn't work at all. When I click "Continue" the second view controller is shown and in that the error message in the "If" part is displayed.
else{
//This code will help to navigate from Menu types to Create Menu Screen
[self performSegueWithIdentifier:@"sw_contmenu" sender: self];
}
}
I have 2 segue for my MenuViewController: sw_contmenu and sw_newmenu, which will be executed from 2 different methods.
Problem: When I run the code and click Continue button, the above function is invoked with null values but the else part of the function doesn't work.
Upvotes: 1
Views: 40
Reputation: 5858
You have an extra action segue that is causing the second view controller to be pushed into view at the same you are handling the button press. These two operations are in conflict.
Deleting the action segue and adding a Show segue between the first view controller and second view controller should fix the problem.
Upvotes: 1