アプリには、純粋に URL を含む 2 つのラベルがあります。
-(void)openURLA{
NSString *url = @"http://urla.com";
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:url]];
}
-(void)openURLB{
NSString *url = @"http://urlb.com";
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:url]];
}
そして、既存のメソッド内のこのコード:
UITapGestureRecognizer *gra = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openURLA)];
UITapGestureRecognizer *grb = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openURLB)];
ユーザーがこれらのラベルのいずれかをタップすると、openURL メソッドが正常に実行され、URL がサファリで開きます。
URL を開き、label1.text または label2.text 値を含む引数を渡すメソッドを 1 つだけ作成するにはどうすればよいでしょうか?
どこから始めればよいか 100% 確信が持てないので、助けていただければ幸いです。