简体   繁体   中英

Change background color of facebook login button for ios

I am using facebook sdk for facebook login but I am unable to customize facebook button. Is there any way I can subclass my button as FBSDKLoginButton and change the background color as my need.Thank you.

I will simplify this:

1- make the facebook button but dont show it (don't addsubView the facebook page)

2- make a UIButton of your own, customize it the way you want and display it instead iof the faecbook button

3- onClick of your button fake the touch of the hidden facebook button [facebookbutton sendActionsForControlEvents: UIControlEventTouchUpInside];

Happy coding!

You can make your own UIButton and connect with login function.

Try to check the link below, FBSDK docs.

https://developers.facebook.com/docs/facebook-login/ios#custom-login-button

In Swift

  1. Make your own design UIButton.

  2. Create button action on your viewcontroller class.

  3. Add the following line inside button action,

    loginButtonFacebook.sendActions(for: .touchUpInside)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM