0

UIToolbars normally center their icons vertically. I want to make their icons to be partially outside the bar. See the picture:

enter image description here

Is it possible to have control over the buttons Y position, overriding the UIToolbar default positioning?

Thanks.

jszumski
  • 7,430
  • 11
  • 40
  • 53
Duck
  • 34,902
  • 47
  • 248
  • 470
  • It would probably be easiest to achieve this by setting a background for the toolbar that has transparency partway up so it appears as though your buttons extend past the top. – Dan F Apr 23 '13 at 20:40
  • I thought about this possibility but was trying to see if there was an alternative first. :) – Duck Apr 23 '13 at 20:44
  • The problem with trying to move the buttons "above" the top of the toolbar is that it is likely that the portion of the button that is outside of the normal toolbar will not be interactive, since it is not contained within its superview's frame – Dan F Apr 23 '13 at 20:45
  • ok, but like UIButtons I can extend the touch area to outside the normal size of the buttons. I suppose I can do that too with toolbars. – Duck Apr 23 '13 at 20:46
  • How do you do it with `UIButton`? Is that same interface available in `UIToolbar`? – Dan F Apr 23 '13 at 20:55
  • you just create a UIButton subclass [like this](http://stackoverflow.com/questions/808503/uibutton-making-the-hit-area-larger-than-the-default-hit-area). I think the same principle can be applied to any touch element. – Duck Apr 24 '13 at 01:23

1 Answers1

0

If you want to use UIToolbar you can't add UIButtons directly, but have to use UIBarButtonItems.

Why not just have a UIView as a container for your buttons and then add a background image or another view with the green color behind your buttons?

jszumski
  • 7,430
  • 11
  • 40
  • 53
JonahGabriel
  • 3,066
  • 2
  • 18
  • 28
  • I know about the UIBarButtonItem stuff. I think the way to go will be to create a UIView. Thanks. – Duck Apr 24 '13 at 03:29