objective c - Custom keyboard buttons iOS -
i trying setup highlighted state keyboard buttons, have difficulties it:
- i can't set
backgroundimage
beneathspacebutton image
, won't overlapshift_1
on image below (button tapped). - i can't set layer margins, there space bottom , other buttons, , @ same time spacing function button.
below code:
[self.spacebutton setimage:[uiimage imagenamed:@"shift_1"] forstate:uicontrolstatenormal]; [self.spacebutton setbackgroundimage:[keyboardviewcontroller imagefromcolor:[uicolor colorwithwhite:0.4 alpha:0.5]] forstate:uicontrolstatehighlighted]; self.spacebutton.layer.cornerradius = 7.0; self.spacebutton.layer.maskstobounds = yes;
i thankful if me.
you have 2 ways:
by image : add transparent pixel @ bottom,left,right in image , create new image set image in background image of button.
by imageedgeinsets
: set button imageedgeinsets
, use image
property set image(highlighted/normal state).
Comments
Post a Comment