Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Facebook Login button iOS

I've just integrated the Facebook iOS SDK with my app, and the login works great. That said, the SDK doesnt seem to give me the option to customize my login button (it provides me with that ugly default button in the middle of the screen). I'm using Storyboards with my app - how can I go about hooking up my own button to their provided code? I've seen some older answers posted to Stack, but the FB documentation has since changed :/

Viewcontroller.m

 FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
 loginButton.center = self.view.center;
 [self.view addSubview:loginButton];
like image 576
Brittany Avatar asked Feb 02 '16 17:02

Brittany


1 Answers

Make you own custom button in the storyboard. Hook up the action to myButtonPressed.

- (void)viewDidLoad {
    [super viewDidLoad];
    self.loginButton = [[FBSDKLoginButton alloc] init];
    self.loginButton.hidden = YES;
}

- (void)myButtonPressed {
    [self.loginButton sendActionsForControlEvents: UIControlEventTouchUpInside];
}
like image 72
bearMountain Avatar answered Sep 21 '22 23:09

bearMountain