0

APIがないと仮定すると、LIKEボタンをどのように実装しますか?

たとえば。ビューにボタンを設定しました

UIButton *likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [likeButton setTitle:@"Like" forState:UIControlStateNormal];
    [likeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    likeButton.frame=CGRectMake(10, 10, 100,30);

いいねボタンを検出するためのセレクター付き

[likeButton addTarget:self action:@selector(likeButtonPressedAction:) forControlEvents:UIControlEventTouchUpInside];

USERをlikeButtonPressedActionセレクターに渡して、LIKEが押されたユーザーを知ることはできますか?つまり、LIKEボタンが押されたかどうかは検出できますが、そのLIKEが誰に属しているかを検出する方法がわかりません。

4

1 に答える 1

0

タグを使用して必要なビューを認識するのが最善の方法のようです。

于 2012-09-02T16:57:05.907 に答える