i'm working on app , need change default design of facebook button provided facebook sdk. succeeded let provided button transparent , stick above on designed view , , worked well(now design matched , functionality of facebook sdk button working well). problem turned after did because button lost it's ui effects (no highlighting upon clicking). please if 1 can me , need put highlighting effect designed button. let clarify: i've uiview designed button , i've put transparent facebook sdk button above it, result shape of design , functionality of facebook button @ same time ,the loses : no highlighting effect upon clicking.
i've tried following code , gives functionality in right manner.however failed give highlighting effect button upon clicking on it. here code :
{ if (fbsdkaccesstoken.currentaccesstoken() != nil) { // if user logged in handletap func run instead of button functionality let tap = uitapgesturerecognizer(target: self, action: "handletap:") self.btnsignupwithfacebook.addgesturerecognizer(tap) } else { let loginview : fbsdkloginbutton = fbsdkloginbutton() self.view.addsubview(loginview) loginview.center = self.btnsignupwithfacebook.center loginview.frame.size.width = self.btnsignupwithfacebook.frame.width loginview.frame.size.height = self.btnsignupwithfacebook.frame.height loginview.frame.origin.x = self.btnsignupwithfacebook.frame.origin.x loginview.frame.origin.y = self.btnsignupwithfacebook.frame.origin.y subview in loginview.subviews { subview.removefromsuperview() } loginview.layer.shadowcolor = uicolor.clearcolor().cgcolor loginview.setbackgroundimage(nil, forstate: uicontrolstate.normal) loginview.setbackgroundimage(nil, forstate: uicontrolstate.application) loginview.setbackgroundimage(nil, forstate: uicontrolstate.allzeros) loginview.setbackgroundimage(nil, forstate: uicontrolstate.highlighted) loginview.setbackgroundimage(nil, forstate: uicontrolstate.reserved) loginview.setbackgroundimage(nil, forstate: uicontrolstate.selected) loginview.setimage(nil, forstate: uicontrolstate.normal) loginview.setimage(nil, forstate: uicontrolstate.application) loginview.setimage(nil, forstate: uicontrolstate.allzeros) loginview.setimage(nil, forstate: uicontrolstate.highlighted) loginview.setimage(nil, forstate: uicontrolstate.reserved) loginview.setimage(nil, forstate: uicontrolstate.selected) loginview.backgroundcolor = uicolor.clearcolor() // test self.btnsignupwithfacebook.layer.borderwidth = 1 self.btnsignupwithfacebook.layer.bordercolor = uicolor.whitecolor().cgcolor loginview.layer.backgroundcolor = uicolor.clearcolor().cgcolor loginview.readpermissions = ["public_profile", "email", "user_friends"] loginview.delegate = self loginview.settranslatesautoresizingmaskintoconstraints(false) var constx = nslayoutconstraint(item: loginview, attribute: nslayoutattribute.centerx, relatedby: nslayoutrelation.equal, toitem: self.btnsignupwithfacebook, attribute: nslayoutattribute.centerx, multiplier: 1, constant: 0) view.addconstraint(constx) var consty = nslayoutconstraint(item: loginview, attribute: nslayoutattribute.centery, relatedby: nslayoutrelation.equal, toitem: self.btnsignupwithfacebook, attribute: nslayoutattribute.centery, multiplier: 1, constant: 0) view.addconstraint(consty) let views = ["loginview": loginview] var consth = nslayoutconstraint.constraintswithvisualformat("h:[loginview(57)]", options: nslayoutformatoptions(0), metrics: nil, views: views) view.addconstraints(consth) var constw = nslayoutconstraint.constraintswithvisualformat("v:[loginview(281)]", options: nslayoutformatoptions(0), metrics: nil, views: views) view.addconstraints(constw) } actually major problem facebookloginbutton customized class fbsdk , swift doesn't consider uibutton that's why no highlighting property appears. point i'm aiming find guys find way let's facebookloginbutton considered uibutton in swift.
Comments
Post a Comment