Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: How to make UIButton which you can easily tap?

I'm making customized navigation bar by using UIView and UIButtons instead of UINavigationBar.

But my UIButtons on the navigation bar doesn't response sensitively.

I have to tap almost center of the UIButton to tap.
It doesn't respond if I tap edge of the UIButton.

But buttons on normal UINavigationBar can be tapped by tapping edge of the button.
Even by tapping outside of the button, it can be tapped.

Shutter button or Option button on the camera app also can be tapped by tapping edge or outside of buttons.

How can I implement those easily tappable buttons to my app?

like image 610
js_ Avatar asked Jun 26 '12 17:06

js_


People also ask

What is UI button in Swift?

A control that executes your custom code in response to user interactions.


1 Answers

Use an image and create a custom button. Set the button so the image does not scale to the size of the button's view, but instead will just Center. Expand the button's size so it is larger than the image on each side. Apple does this as well with things like tab buttons.

like image 194
Owen Hartnett Avatar answered Oct 21 '22 01:10

Owen Hartnett