objective c - iOS bordered button behaviour on tap -


i need pre-ios uibutton border in app. use:

btn.layer.bordercolor = [uicolor blackcolor].cgcolor;  btn.layer.borderwidth = 1.0;  btn.layer.cornerradius = 10; 

this works ok on tap border not flash(button highlight state). way implement ?

implement when creating button:

[self.botonconfigurar addtarget:self action:@selector(setbgcolorforbutton:) forcontrolevents:uicontroleventtouchdown]; [self.botonconfigurar addtarget:self action:@selector(clearbgcolorforbutton:) forcontrolevents:uicontroleventtouchdragexit]; [self.botonconfigurar addtarget:self action:@selector(setbgcolorforbutton:) forcontrolevents:uicontroleventtouchdragenter]; 

and these 2 functions:

-(void)setbgcolorforbutton:(uibutton*)sender {      [self.botonconfigurar settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];     self.botonconfigurar.layer.backgroundcolor = [uicolor colorwithred:89/255.0 green:194/255.0 blue:237/255.0 alpha:1.0].cgcolor; }  -(void)clearbgcolorforbutton:(uibutton*)sender {      [self.botonconfigurar settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];     self.botonconfigurar.layer.backgroundcolor = [uicolor colorwithred:61/255.0 green:169/255.0 blue:222/255.0 alpha:1].cgcolor;  } 

do whatever want button inside these functions.

pd: make button [uibutton buttonwithtype:uibuttontypecustom]

pd2: in clearbgcolorforbutton:sender write uibutton's original parameters.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -