How to adapt or custom the shape of a IBOutlet button as the inner button's image in Swift iOS8 -


i have iboutlet button dragged interface builder (it's easier play in auto layout )

i rotated 45° in code learned here

var transform = cgaffinetransformmaketranslation(0.5, 0.5) var angle = cgfloat(m_pi / 3.9) // degress rotation 3.9 transform = cgaffinetransformrotate(transform, angle) button.transform = transform button.layer.rasterizationscale = uiscreen.mainscreen().scale button.layer.shouldrasterize = true button.setneedsdisplay() 

now, have diamond, triangle, rectangle shaped images put inside many iboutlets. iboutlets required side side. there margins of button don't know how cut off.

enter image description here

so, purple good, yellow bad. purple area "the button" image need cut off yellow margins area (now set clear color, clickable anyway, , don't want be)

i need make ui on iphone made many shapes, each of them side side other, , don't want unwanted area of button "cover" half button next it. help?

thanks in advance

button tapping based on rectangular, non-rotated area. can't make button's tappable area irregular shape, , can't overlap bounds rectangles.

you rotate coordinate system of superview contains buttons, tilted 45 degrees. way have rows , columns of square buttons diamonds, , did respond taps in each region.

you create custom view class manages grid of irregularly shaped objects act buttons, , detect taps based on opaque parts of images contain, quite bit of work, , involve advanced techniques beyond scope of post explain.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -