ios - how to set the values for UIEdgeinset for button -


i wanted increase button touch area without without increasing original size.

when comes insets there many in button , there no clear documentation find on differences

  • content insets

  • title insets

  • image insets

so later on thought try on content inset. according other stack overflow answers settings negative value co-ordiantes(left,top,right,bottom) increase touch area of button without increasing width , height.

but interfacebuilder doesn't allow me enter values on all.

for example if enter -10 in left , couldn't enter -10 in right , others that.

i confused on can me unravel complexity

thanks

try this:

func setupbutton(button: uibutton) {     button.titleedgeinsets = uiedgeinsetsmake(top, left, bottom, right)     button.imageedgeinsets =  uiedgeinsetsmake(top, left, bottom, right)     button.contentedgeinsets =  uiedgeinsetsmake(top, left, bottom, right) } 

you can refer this link more elaborated answer.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -