Objective c 按顺序呼叫两次
我正在使用故事板。对于push segue的验证,我使用“-(BOOL)shouldPerformSegueWithIdentifier:(NSString*)identifier sender:(id)sender”这个方法,但它调用两次意味着在单击两下之后,它将打开下一个视图,这个方法也调用了两次,我无法找出问题所在。任何人都可以帮我解决这个问题 这是我的密码-Objective c 按顺序呼叫两次,objective-c,ios7,Objective C,Ios7,我正在使用故事板。对于push segue的验证,我使用“-(BOOL)shouldPerformSegueWithIdentifier:(NSString*)identifier sender:(id)sender”这个方法,但它调用两次意味着在单击两下之后,它将打开下一个视图,这个方法也调用了两次,我无法找出问题所在。任何人都可以帮我解决这个问题 这是我的密码- -(BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier se
-(BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender
{
if ([identifier isEqualToString:@"pushTab"])
{
if ([emailTxt.text isEqualToString:@""] || [passwordTxt.text isEqualToString:@""])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Please
put your id or password" delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return NO;
}
else
{
emailText = emailTxt.text;
passwordText = passwordTxt.text;
Login *loginModel = [[Login alloc]init];
[ASKevrOperationManager login:loginModel handler:^(id object , NSError *error
, BOOL success)
{
if (success)
{
flag = true;
NSLog(@"Successful data = %@",object);
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Wrong Id or Password" delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
flag = false;
NSLog(@"Invalid Data");
}
}];
if (flag == true) {
return YES;
}
}
}
return NO; }
试着用这个方法,
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//Stuff
}
我已经用过了,但它不能正常工作这就是为什么我用这种方法我得到了答案。非常感谢你的提示。发生了什么事previosly@Sunny:不,它坏了。。