gpt4 book ai didi

ios - 当我们在 ios 中获取 facebook 用户详细信息时如何删除注销按钮标题

转载 作者:搜寻专家 更新时间:2023-11-01 05:44:44 26 4
gpt4 key购买 nike

Hi aim beginner in Ios,在我的项目中,我正在为用户添加 face-book 登录工具

当用户单击登录按钮输入正确的用户 ID 和密码时,它会像下图那样请求权限,然后我单击“确定”按钮,然后它会调用下面的方法

  • (void)loginViewFetchedUserInfo:(FBLoginView *)loginView 用户:(id)用户{

它被重定向到我的 Mainviewcontroller enter image description here

并且登录按钮标题显示“注销”,如下图浅灰色图像,然后它被重定向到另一个页面但是我不想在我们调用上面的委托(delegate)方法时显示注销按钮,我想显示像“使用 face-book 登录”这样的标题可以帮助我

enter image description here

我的代码如下:

#import "HomeViewController.h"
#import "HomeViewController1.h"

@interface HomeViewController ()
{
FBLoginView *loginview;
UILabel * loginLabel;
}

@end

@implementation HomeViewController
@synthesize fblogin;

- (void)viewDidLoad
{
[super viewDidLoad];

loginview = [[FBLoginView alloc]init];
loginview.frame = CGRectMake(10, 95, 271, 37);
loginview.readPermissions = @[@"public_profile", @"email", @"user_friends"];

for (id obj in loginview.subviews)
{
if ([obj isKindOfClass:[UIButton class]])
{
UIButton * loginButton = obj;
UIImage *loginImage = [UIImage imageNamed:@"YourImg.png"];
[loginButton setBackgroundImage:loginImage forState:UIControlStateNormal];
[loginButton setBackgroundImage:nil forState:UIControlStateSelected];
[loginButton setBackgroundImage:nil forState:UIControlStateHighlighted];
loginButton.backgroundColor = [UIColor lightGrayColor];
}

if ([obj isKindOfClass:[UILabel class]])
{
loginLabel = obj;
loginLabel.text = @"Log in with Facebook";
loginLabel.textAlignment = NSTextAlignmentCenter;
loginLabel.frame = CGRectMake(0, 0, 271, 37);
}
}

loginview.delegate = self;
[self.view addSubview:loginview];
[super viewDidLoad];
}

// This method will be called when the user information has been fetched
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user {

NSLog(@"User Id : %@",user.id);
NSLog(@"User Name : %@",user.name);

HomeViewController1 * home1 = [self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController1"];
[self presentViewController:home1 animated:YES completion:nil];

}

最佳答案

如果获取信息,button.hidden = true

关于ios - 当我们在 ios 中获取 facebook 用户详细信息时如何删除注销按钮标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32205406/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com