私はiOSが初めてです。
私はアラートビューに取り組んでいます。これが私のコードです。ここには 2 つのアラートビューがありsuccessfulallert
ますunsuccessfulallert
。ログイン ページ用です。ここでもアラートビューデリゲートを使用しています。両方のアラートビューで機能しますが、アラートビューが成功した場合にのみ機能し、アラートビューが成功した場合にのみナビゲーションを実行する必要があります。誰かがこれを知っているなら、私を助けてください。
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];
}
}