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 回答