0

agencyWebsiteこのメソッドでクリックしたときに Web サイトを開く変数とラベルがあります。

- (void)website1LblTapped {
    NSURL *url = [NSURL URLWithString:self.agencyWebsite];
    [[UIApplication sharedApplication] openURL:url];
}

コンパイラで次のような警告が表示されます。

Incompatible pointer types sending UILabel* to parameter of type NSString*

また、リンクをクリックするとアプリがクラッシュします。助言がありますか?

編集:ラベルをクリック可能にするために私がやっていることは次のとおりです

UITapGestureRecognizer* website1LblGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(website1LblTapped)];
    // if labelView is not set userInteractionEnabled, you must do so
    [self.agencyWebsite setUserInteractionEnabled:YES];
    [self.agencyWebsite addGestureRecognizer:website1LblGesture];

私がそれを機能させるために使用したもの

 NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", self.agencyWebsite.text]];
4

1 に答える 1