objective c - Remove shadow of UIButton when using setBackgroundImage on iOS -


i creating custom iphone keyboard, there problem uibutton

i using code create gradient button

        let gradient = cagradientlayer()     gradient.frame = self.bounds     let gradientcolors: [anyobject] = [uicolor(red: 253.0/255, green: 253.0/255, blue: 253.0/255, alpha: 1.0).cgcolor, uicolor(red: 253.0/255, green: 153.0/255, blue: 53.0/255, alpha: 1.0).cgcolor]     gradient.colors = gradientcolors     self.setbackgroundimage(gradient.uiimagefromcalayer(), forstate: uicontrolstate.normal) 

it works great there glitch. create gradient add thin shadow on right , bottom of button.

enter image description here

i tried not gradient, , added solid color, same shadow there.

finally used code change background color

self.backgroundcolor = uicolor(red: 253.0/255, green: 253.0/255, blue: 253.0/255, alpha: 1.0) 

it worked , shadow wasn't there anymore. coused problem. button not change color on highlighted stat of uibutton.

is there way rid of shadow, or makes uibutton color change on highlighted state (and selected state)?

i've tried solution including changing shadow, border , .... nothing worked. :|

i tried :

        if (self.state == uicontrolstate.normal) {         self.backgroundcolor = uicolor(red: 153.0/255, green: 53.0/255, blue: 53.0/255, alpha: 1.0)     }     else if (self.state == uicontrolstate.reserved) {         self.backgroundcolor = uicolor(red: 253.0/255, green: 253.0/255, blue: 253.0/255, alpha: 1.0)     } 

but again did not worked.

thanks.

play layer property of button may helpful removing shadow, following link work layer property of button

there's shadow on button

how can remove shadow in iphone


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -