我正在使用故事板。驗證推入segue我使用「 - (布爾)shouldPerformSegueWithIdentifier :(NSString *)標識符發件人:(id)發件人」這種方法,但它的調用兩次意味着2次點擊後它打開下一個視圖,這種方法也調用2次和我無法找出問題。任何人都可以幫助我解決這個問題。推塞格呼叫兩次
這裏是我的代碼 -
-(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; }
是現在的工作? – Balu
@Sunny:不,它不工作.. – chaaruu