objective c - Custom keyboard buttons iOS -


i trying setup highlighted state keyboard buttons, have difficulties it:

  1. i can't set backgroundimage beneath spacebutton image, won't overlap shift_1 on image below (button tapped).
  2. 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.

enter image description here

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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

gradle error "Cannot convert the provided notation to a File or URI" -