facebook和pinterest是如何实现他们的LIKE方法的



假设他们没有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);

带有检测lIKE按钮的选择器

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

是否可以将USER传递给likeButtonPressedAction选择器,这样我就知道LIKE被按下了哪个用户?即,我可以检测LIKE按钮是否被按下,但我不确定如何检测LIKE属于谁。

似乎最好的方法是使用标签来识别所需的视图。

相关内容

最新更新