how to use different shape of UIButton - ios

I am having below image for UIButton background image.
But UIbutton shape by default is round rect.So touch up inside event will work only in round rect area.
So how can i support touchup inside event for below shape (entire area).

Hope this link helps.
To create an irregular shaped button, you need to create custom button and perform hitTest to check if button was pressed or empty space was pressed.

You can use UIButtonTypeCustom and give the correct frame.

Related

How to scale image UIButton to the insets?

I have this UIButton but the insets are not on the image so the button can be activated if the user taps outside the bounds of the image but inside the insets.
How do I fit the image correctly using Interface Builder?
Thank you
note: with rectangular buttons works great but not rounded squared for some reason...
you should add the picture name in the arrow location:
Duh! I had a subtle "drop shadow" on my button style so I deactivated and now it scales good :)

How to move resizableUIView from its corner in Swift?

enter image description here
I have created this screen using four rounded button on corners. and i need to resize view from all four button tapped event. on the button direction
This is what i need to do.

Make UIButton shine on touch

I have a set of invisible UIButtons on the screen. When I say invisible I mean set to 'custom' without an image. I would like to make so that when the button was pressed it glowed for 1 second, so that the user can see he has pressed a button. How can I do this?
Use a blank image for UIControlStateNormal. Make an image for UIControlStateHighlighted which is your glow.
Rethink this design, because it doesn’t sound like it will fit well with the direction iOS 7 is going.

UIButton custom image alpha

I have some buttons close to each other in a logo shape, they are non rectangular shapes and I was wondering if I can exclude the transparent parts of the button from receiving touches, so that the elements behind it can receive the touches instead?.
Can you make the alpha parts of the button image not part of the button? , or , if the user touches these alpha parts, the button below will be tapped?
You would normally have to subclass UIButton, but luckily someone has taken care of this for you already:
https://github.com/ole/OBShapedButton
This seems to be exactly what you're looking for.

Rectangular UIButton

I've read that you can make a UIButton rectangular by setting the cornerRadius, but is this only applicable to custom UIButtons? Is there a way to set the cornerRadius to zero on a default UIButton?
RoundedRectangle Button type means that it would be rounded corners, I don't think it is possible to to set radius to 0 for this button according to my experience, however you could set the background image to it or use custom button type it is quite simple as you have mentioned in your question yourself.
To make a UIButtonTypeRoundedRect type of UIButton rectangular, give the button a rectangular background image (e.g. with setBackgroundImage:forState:).

Resources