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