FBlikeControl按钮图像和文本更改

时间:2014-10-09 05:26:23

标签: iphone facebook ios8

我已经添加了SDK 3.19中提供的FbLike按钮。它运行正常,但我需要更改按钮的图像和文本。我用Google搜索但没有找到任何内容。

1 个答案:

答案 0 :(得分:0)

是的,这可能与更改默认FBLoginView按钮的方式相同。

loginView.frame = CGRectMake(320/2 - 93/2, self.view.frame.size.height -200, 93, 93);

for (id loginObject in loginView.subviews)
{
    if ([loginObject isKindOfClass:[UIButton class]])
    {
        UIButton * loginButton =  loginObject;
        UIImage *loginImage = [UIImage imageNamed:@"YOUR_IMAGE_HERE"];
        loginButton.alpha = 0.7;
        [loginButton setBackgroundImage:loginImage forState:UIControlStateNormal];
        [loginButton setBackgroundImage:nil forState:UIControlStateSelected];
        [loginButton setBackgroundImage:nil forState:UIControlStateHighlighted];
        [loginButton sizeToFit];
    }
    if ([loginObject isKindOfClass:[UILabel class]])
    {
        UILabel * loginLabel =  loginObject;
        loginLabel.text = @"";
        loginLabel.frame = CGRectMake(0, 0, 0, 0);
    }
}