我刚刚将Facebook iOS SDK与我的应用程序集成在一起,登录效果很好。也就是说,SDK似乎没有给我自定义登录按钮的选项(它在屏幕中间为我提供了丑陋的默认按钮)。我在我的应用程序中使用了Storyboards-如何将自己的按钮连接到其提供的代码?我已经看到一些较早的答案发布到Stack,但是FB文档已经更改了:/
Viewcontroller.m
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
在情节提要中让您拥有自定义按钮。将动作挂钩myButtonPressed
。
- (void)viewDidLoad {
[super viewDidLoad];
self.loginButton = [[FBSDKLoginButton alloc] init];
self.loginButton.hidden = YES;
}
- (void)myButtonPressed {
[self.loginButton sendActionsForControlEvents: UIControlEventTouchUpInside];
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句