Cannot change the height of Login Button in FBSDKLoginKit?

后端 未结 12 1638
刺人心
刺人心 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条回答
  •  旧时难觅i
    2021-02-05 09:31

    So I took @Dev-iL's solution and tweaked it to something a bit more future proof. I'm very new to this so it took me a few hours to figure it out, but I thought I'd share since it specifically deactivates the height constraint based on being a height constraint instead of based on the constant value.

    I've used a subview classed as the Facebook button in my storyboard and have set the new constraint there.

    I prefer this method and feel its a cleaner approach.

    Note: I believe for a height constraint it will always be the first value however please correct me if I'm wrong and I'll update with an edit. As I mentioned I'm new to this

    Edit: I decided to include the constant value of 28 to allow for my storyboard height constraint to be skipped during the removal. This isn't needed if you add the constraint programmatically after the removal

    for const in fbLoginButton.constraints{
      if const.firstAttribute == NSLayoutAttribute.height && const.constant == 28{
        fbLoginButton.removeConstraint(const)
      }
    }
    

提交回复
热议问题