Posts

Showing posts with the label Google Signin

Can't Change Custom Class Of UIButton To GIDSignInButton

Image
Answer : You should try assign GIDSignInButton not to the Button Object from the Object library but to the the View Object instead It's work for me. It will look like this using UIView instead of UIButton. That's because GIDSignInButton is a subclass of UIView, not UIButton. Add to the storyboard / nib a regular UIView and change it's class to GIDSignInButton instead. From google doc: Add a GIDSignInButton to your storyboard, XIB file, or instantiate it programmatically. To add the button to your storyboard or XIB file, add a View and set its custom class to GIDSignInButton. You can create UIButton and then on its action method you can write this code for signing via google: GIDSignIn.sharedInstance().signIn() It works for me, in this way you can customize UIButton according to your requirement and also perform signin by using google

Can I Edit The Text Of Sign In Button On Google?

Image
Answer : Here is the technique that I used: protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) { // Find the TextView that is inside of the SignInButton and set its text for (int i = 0; i < signInButton.getChildCount(); i++) { View v = signInButton.getChildAt(i); if (v instanceof TextView) { TextView tv = (TextView) v; tv.setText(buttonText); return; } } } Here is the easiest way that I used: TextView textView = (TextView) signInButton.getChildAt(0); textView.setText("your_text_xyz"); Problem: Other answers have mentioned a workaround. The underlying implementation of the button may change any time which would cause the code to break. I felt uncomfortable trying to use the hacks. For a clean solution, you would think that setting android:text on the com.google.android.gms.common.SignInButton in your layout file would do the trick. However it turns...