我問這個問題很有趣。我使用默認GoogleSign
爲我的swift項目。高度值的變化不會改變按鈕的高度。 無論高度值是59還是500,它都會顯示固定的高度。GoogleSign in`swift 3`錯誤
// GoogleSignIn按鈕
let signInButton = GIDSignInButton(frame: CGRect(x: 400, y: 144, width: 332, height: 59))
我問這個問題很有趣。我使用默認GoogleSign
爲我的swift項目。高度值的變化不會改變按鈕的高度。 無論高度值是59還是500,它都會顯示固定的高度。GoogleSign in`swift 3`錯誤
// GoogleSignIn按鈕
let signInButton = GIDSignInButton(frame: CGRect(x: 400, y: 144, width: 332, height: 59))
你不能放棄自定義尺寸您GoogleSignIn
按鈕。您只能使用三種類型的尺寸,在按鈕中使用style
屬性。
signInButton.style = .IconOnly
signInButton.style = .Standard
signInButton.style = .Wide
謝謝:)
按鈕操縱谷歌唱歌是不允許的。你可以做的是兩者中的任何一個。在Google Sing in按鈕頂部顯示您自己的按鈕,或者僅使用自己的功能製作您自己的服裝按鈕。
例
//add google sing in button
googleBtn.frame = CGRect(x: 16, y: 116 + 66, width: view.frame.width - 32, height: 50)
view.addSubview(googleBtn)
let customButton = UIButton(type: .system)
customButton.frame = CGRect(x: 16, y: 116 + 66 + 66, width: view.frame.width - 32, height: 50)
customButton.backgroundColor = .orange
customButton.setTitle("Custom Google Sing in ", for: .normal)
customButton.setTitleColor(.white, for: .normal)
customButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
customButton.addTarget(self, action: #selector(handlecustomgoogleSingin), for: .touchUpInside)
view.addSubview(customButton)
現在
func handlecustomgoogleSingin(){
GIDSignIn.sharedInstance().signIn()
}
這應該呈現這樣的事情
是的,它不能改變的功能,你需要使用'.style財產。 – PiyushRathi