iOS デバイス用のアプリケーションを作成していますが、下の画像ではいくつかのエラーがあります。
ご覧のとおり、すべて同じですが、エラーの意味しかありませんでした。リンクのコードを追加しました(apple、google、yahoo、
何がうまくいかなかったのかわかりませんが、エラーを止めるために何を変更する必要があるか教えていただければ幸いです。
ご覧のとおり、以下の show alert コードのみがありますが、Xcode には他の 10 個のコードがあります。すべてのスペースを占有したくなかったので、次のように名前を付けました
showAlertOO showAlert1 showAlert2 showAlert3 showAlert4 showAlert5 showAlert6 showAlert7 showAlert8 showAlert9
私の言いたいことが理解できたら
- (void) showAlert {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"hello"
message:@"whats you name"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"apple", @"google" , @"yahoo", nil];
[alert show];
わかりましたので、これはボタンを機能させるために追加したコードであり、これがエラーを引き起こした原因です。
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com/uk"]];
}
if (buttonIndex == 2) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
}
if (buttonIndex == 3) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.yahoo.com"]];
}
以下のコードはすべて問題なく、ここにエラーはありません。私が持っているセットアップを皆さんに見てもらいたかっただけです。
-(IBAction)plus {
counter=counter + 1;
count.text = [NSString stringWithFormat:@"%i",counter];
if(counter == 100)
[self showAlert];
if(counter == 500)
[self showAlert00];
if(counter == 1000)
[self showAlert1];
if(counter == 2500)
[self showAlert2];
if(counter == 5000)
[self showAlert3];
if(counter == 7500)
[self showAlert4];
if(counter == 10000)
[self showAlert5];
if(counter == 15000)
[self showAlert6];
if(counter == 20000)
[self showAlert7];
if(counter == 25000)
[self showAlert8];
if(counter == 30000)
[self showAlert9];
if(counter == 35000)
[self showAlert10];
}
-(IBAction)zero {
counter=0;
count.text = [NSString stringWithFormat:@"%i",counter];
}
- (void)viewDidLoad {
counter=0;
count.text = @"0";
[super viewDidLoad];
}
ありがとうございました。