Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change title of Google Plus Sign in button?

I was searching for solution but to my suprise nobody asked this question yet:

How to change title of Google Sign In button? enter image description here

I was trying to:

  1. override title by setTitle: but didn't help.
  2. find "Sign in" string in Google Plus framework directory but well... my Finder didn't find such string. 3.Use following code which works for changing Facebook Login button:

    for (id obj in self.signInButtonGPP.subviews)
    {
         if ([obj isKindOfClass:[UILabel class]])
         {  UILabel * label =  view;
            label.text = @"Google";
         }}
    

Thank you

like image 966
Łukasz Szpyrka Avatar asked Jan 05 '15 16:01

Łukasz Szpyrka


2 Answers

The resources for the button are contained in the GooglePlus.bundle file. The value for the label is coming from the GooglePlusPlatform.strings file in the bundle.

You can directly edit the value of the Sign in key to have a custom title. (This would be a dirty fix though, you must do it for all the locales.) enter image description hereenter image description here

And while doing that be sure to comply with the Google+ Sign-In button branding guidelines.

like image 54
Alp Avatar answered Sep 28 '22 07:09

Alp


Well.. I think you can use same solution I used when it came to change Facebook login button text. Maybe its not the best & clean way, but.. it works. All you need to do is to set your original G+ login button frame to CGRectZero, and than add your own button with the same look as G+ button has, and custom text. Than, when you detect touch on your button you need to pass it to G+ button like this:

[self.gppSigninButton sendActionsForControlEvents:UIControlEventTouchUpInside];

Didn't test it, but i think it'll work fine. Hope it'll help you.

like image 45
co- Avatar answered Sep 28 '22 06:09

co-