1)当我创建一个尺寸为(x,y)的UIView
,并且其类型为GIDSignInButton
时,它显示大小为(z,t)的Google登录按钮,其中z < x
和t < y
。为什么?如何显示大小为(x,y)的Google登录按钮?如何自定义谷歌登录按钮?
2)我用CocoaPods添加了Google Sign In SDK。如何设置Google登录按钮中文字的对齐方式?我怎样才能设置字体大小?
我按照Google文档中的说明添加了Google登录按钮。
1)当我创建一个尺寸为(x,y)的UIView
,并且其类型为GIDSignInButton
时,它显示大小为(z,t)的Google登录按钮,其中z < x
和t < y
。为什么?如何显示大小为(x,y)的Google登录按钮?如何自定义谷歌登录按钮?
2)我用CocoaPods添加了Google Sign In SDK。如何设置Google登录按钮中文字的对齐方式?我怎样才能设置字体大小?
我按照Google文档中的说明添加了Google登录按钮。
自定义GIDSignInButton
为了您的两个问题:
谷歌不允许我们定制GIDSignInButton
以各种方式。但是有一些可用的属性,我们可以改变。
下面将介绍这些属性并说明如何设置它们。我们将在名为signInButton
的插座按钮上设置这些属性。
GIDSignInButtonStyle
:登录按钮的布局样式。
[self.signInButton setStyle:kGIDSignInButtonStyleIconOnly];
style
属性有三个可能的值。
kGIDSignInButtonStyleStandard
::230×48(默认值)kGIDSignInButtonStyleWide
:312×48kGIDSignInButtonStyleIconOnly
:48×48(没有文本的,固定大小)GIDSignInButtonColorScheme
:配色方案为登录按钮。
[self.signInButton setColorScheme:kGIDSignInButtonColorSchemeDark];
colourScheme
属性有两个可能的值。
kGIDSignInButtonColorSchemeDark
kGIDSignInButtonStyleWide
:(默认)IBOutlet UIViewController *
:委派
DelegateViewController *uiVC = [[DelegateViewController alloc] init];
[self.signInButton setDelegate:uiVC];
如果你想在按钮只是标志谷歌的标志,你将不得不设置视图尺寸大于48X48,这是默认设置尺寸为标志。
欲了解更多参考,您可以访问Google Sign-In for iOS