Cannot change the height of Login Button in FBSDKLoginKit?

后端 未结 12 1628
刺人心
刺人心 2021-02-05 09:19

I am using FBSDKLoginKit in iOS with Swift.

Up until recently it has been working perfectly, however I now cannot override the height of my button in the St

12条回答
  •  孤独总比滥情好
    2021-02-05 09:37

    We had the same problem. We solve this problem by creating the button in code with initWithFrame method.

    from documentation

    FBSDKLoginButton has a fixed height of @c 30 pixels, but you may change the width. initWithFrame:CGRectZero will size the button to its minimum frame.

    this solution is working for us

    let facebookButton = FBSDKLoginButton(frame:facebookButtonPlaceholder.bounds)
    facebookButton.readPermissions = ["email"]
    facebookButton.backgroundColor = UIColor.clear
    facebookButtonPlaceholder.addSubview(facebookButton)
    facebookButtonPlaceholder.backgroundColor = UIColor.clear
    

提交回复
热议问题