1
votes

I have a functional Facebook login button for an iOS app. I have used a an UIView and made it to a custom class FBSDKLoginButton. I was wondering how to customize the login view so that instead of its standard looks and feel, I could modify the color and the Facebook icon.


I am using Swift and downloaded the Facebook SDK using Cocoapods.

2

2 Answers

0
votes

Try this

        for view in loginView.subviews as [UIView]
    {
        if view.isKindOfClass(UIButton)
        {
            var btn = view as UIButton;
            let image = UIImage(named: "name") as UIImage?
            btn.setBackgroundImage(image, forState: .Normal)
            btn.setBackgroundImage(image, forState: .Selected)
            btn.setBackgroundImage(image, forState: .Highlighted)

        }
        if view.isKindOfClass(UILabel)
        {
            var lbl = view as UILabel;
           lbl.text = "Log in to facebook";

        }
    }
0
votes

You can use a UIButton, and customise it according to your need.

Find detailed code here.