Custom Log in with Facebook button using swift in iOS app -
i trying customize facebook's fbsdkloginbutton (name of class) in sense want possibly delete fb logo, , change background color, font , font color.
i doing research , unfortunately not able find related topic.
now major question is, have create button , somehow connect default fb functionality it, or have code scratch (which don't think case). of now, have default login button working creating button , declaring fbsdkloginbutton , work perfectly. also, accessed it's properties after instantiating see if there change in viewdidload, such text, background color, etc not find anything.
i appreciate if point me in right direction on how achieve (tutorials, advice, etc.).
thank reading post , in advance.
cheers!
you may try following options:
1) create own subclass of fbsdkloginbutton , override drawrect: decorate custom , feel
2) easy way - use own uibutton subclass.
update:
for case 1 can try overriding following implementations -
- (void)configurebutton { [self configurewithicon:[[self class] defaulticon] title:nil backgroundcolor:[[self class] defaultbackgroundcolor] highlightedcolor:[[self class] defaulthighlightedcolor]]; } - (void)configurewithicon:(fbsdkicon *)icon title:(nsstring *)title backgroundcolor:(uicolor *)backgroundcolor highlightedcolor:(uicolor *)highlightedcolor { [self _configurewithicon:icon title:title backgroundcolor:backgroundcolor highlightedcolor:highlightedcolor selectedtitle:nil selectedicon:nil selectedcolor:nil selectedhighlightedcolor:nil]; } - (void)configurewithicon:(fbsdkicon *)icon title:(nsstring *)title backgroundcolor:(uicolor *)backgroundcolor highlightedcolor:(uicolor *)highlightedcolor selectedtitle:(nsstring *)selectedtitle selectedicon:(fbsdkicon *)selectedicon selectedcolor:(uicolor *)selectedcolor selectedhighlightedcolor:(uicolor *)selectedhighlightedcolor { if (!selectedcolor) { selectedcolor = [self defaultselectedcolor]; } if (!selectedhighlightedcolor) { selectedhighlightedcolor = highlightedcolor; } [self _configurewithicon:icon title:title backgroundcolor:backgroundcolor highlightedcolor:highlightedcolor selectedtitle:selectedtitle selectedicon:selectedicon selectedcolor:selectedcolor selectedhighlightedcolor:selectedhighlightedcolor]; } - (uicolor *)defaultbackgroundcolor { return [uicolor colorwithred:65.0/255.0 green:93.0/255.0 blue:174.0/255.0 alpha:1.0]; } - (uicolor *)defaultdisabledcolor { return [uicolor colorwithred:189.0/255.0 green:193.0/255.0 blue:201.0/255.0 alpha:1.0]; } - (uicolor *)defaulthighlightedcolor { return [uicolor colorwithred:47.0/255.0 green:71.0/255.0 blue:122.0/255.0 alpha:1.0]; } - (fbsdkicon *)defaulticon { return [[fbsdklogo alloc] init]; } - (uicolor *)defaultselectedcolor { return [uicolor colorwithred:124.0/255.0 green:143.0/255.0 blue:200.0/255.0 alpha:1.0]; }
reference : https://github.com/facebook/facebook-ios-sdk/blob/master/fbsdkcorekit/fbsdkcorekit/fbsdkbutton.m
Comments
Post a Comment