私はiOSを初めて使っています。そのalertviewのボタンをクリックするとalertviewを解除する方法
私はalertviewsに取り組んでいます。ここに私のコードです。ログインページには、successfulallert
とunsuccessfulallert
という2つのアラートビューがあります。私はalertviewデリゲートをここでも使用していますが、両方のalertviewsで動作しますが、正常なalertviewでのみ動作したいのですが、ナビゲーションは正常なalertviewに対してのみ行うべきです。誰かがこれを知っていれば私を助けてください。
NSString *responseOfResult = [[NSString alloc]initWithString:[result response]];
NSRange match;
// NSLog(@"string= %@", str);
match = [responseOfResult rangeOfString: @"successful"];
if(match.location == NSNotFound)
{
UIAlertView *unsuccessfulAllert = [[UIAlertView alloc]
initWithTitle:@"Alert"
message:responseOfResult
delegate:self
cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[unsuccessfulAllert show];
}
else {
UIAlertView *successfulAllert = [[UIAlertView alloc]
initWithTitle:@"Message" message:@"Login successful." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[successfulAllert show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 0){
[[self navigationController]pushViewController:registerUserScreen animated:YES];
}
}
2番目の 'if'ステートメントに' .tag'がありません。 – Mat
あなたは正しいマットでした。今私は間違いを訂正しました。 –