4

Is there a way to force the Facebook Login Button so it displays "Log in" as opposed to "Log in with Facebook"? Below is what it looks like on an iPhone 6

enter image description here

And below on an iPhone 6 Plus

enter image description here

I have briefly looked at the Facebook SDK on Github and have failed to come up with a solution. Facebook basically looks at the width of the button then displays the appropriate text. I don't want the text to overrun like it is on the iPhone 6 Plus.

TYRONEMICHAEL
  • 4,174
  • 4
  • 30
  • 47
  • You can use Custom button instead of Facebook's default button. look at this link http://stackoverflow.com/questions/12280850/how-to-customize-fbloginview – Saurabh Prajapati Jul 17 '15 at 08:37

2 Answers2

8

There's actually a very easy way to customize the text of a FBSDKLoginButton. Here you go:

var fbButton = FBSDKLoginButton()
var titleText = NSAttributedString(string: "Your new button title")
fbButton.setAttributedTitle(titleText, forState: UIControlState.Normal)
Matt Schwartz
  • 143
  • 2
  • 8
2

From the Facebook docs:

Localizing Facebook Strings

The SDK installer includes a FacebookSDK.strings file that is a localizable as described in Apple's localization guide. You can include the file in your app and localize it like a typical strings file.

You can copy the FacebookSDK.strings file located in the resources directory of the downloaded Facebook sdk and paste it in your project directory. The default string for the key: LoginButton.LogInLong is Log in with Facebook, you can change the string to whatever you like.

juanjo
  • 3,737
  • 3
  • 39
  • 44