1

1) When I created a UIView which has size (x, y), and made its type GIDSignInButton, it shows up a Google Sign In button in the size (z, t) where z < x and t < y. Why? How can I make it show a Google Sign In button with size (x, y)?

2) I added Google Sign In SDK with CocoaPods. How can I set the alignment of the text in the Google Sign In button? How can I set the font size?

I added Google Sign In button as described in the Google's doc.

manman
  • 4,743
  • 3
  • 30
  • 42
Burak Tutanlar
  • 140
  • 2
  • 11

1 Answers1

5

Customize GIDSignInButton

For your both questions:

Google doesn't allow us to customise the GIDSignInButton in every way. But There are some properties available that we can change.

The properties are mentioned below and explained how to set them. We will set these properties on the outlet button named signInButton.

  1. GIDSignInButtonStyle : The layout style for the sign-in button.

    [self.signInButton setStyle:kGIDSignInButtonStyleIconOnly];
    

    The style property has three possible values.

    • kGIDSignInButtonStyleStandard : : 230 x 48 (default)
    • kGIDSignInButtonStyleWide : 312 x 48
    • kGIDSignInButtonStyleIconOnly : 48 x 48 (no text, fixed size)
  2. GIDSignInButtonColorScheme : The color scheme for the sign-in button.

    [self.signInButton setColorScheme:kGIDSignInButtonColorSchemeDark];
    

    The colourScheme property has two possible values.

    • kGIDSignInButtonColorSchemeDark
    • kGIDSignInButtonStyleWide : (Default)
  3. IBOutlet UIViewController * : Delegate

    DelegateViewController *uiVC = [[DelegateViewController alloc] init];
    [self.signInButton setDelegate:uiVC];
    

If you want google sign in button as just logo, you will have to set the view size bigger then 48X48, which is default size for the logo.

For further references you can visit Google Sign-In for iOS

Guy
  • 2,883
  • 1
  • 32
  • 39
Manan Devani
  • 434
  • 3
  • 15