0

I have a UIToolBar at the top of one of my views and the shadowing shows up on the bottom of the tool bar as I'd expect. I know UIToolbarPosition is internally set to UIToolbarPositionTop.

When I rotate my device (iPad), the tool bar grows (using auto sizing in IB) and the UIToolbarPosition changes to UIToolbarPositionBottom which flips the shadow to be at the top of the bar. If I don't have the bar resize, it remains correct, but of course doesn't stretch to match screen width.

So, what gives? What would cause the UIToolbarPosition to flip on me? This is sitting at 0,0 the whole time and only changes width based on rotation.

Extra: I've considered work arounds like using a UINavigationBar. UIAppearance is probably a no go because I do have a toolbar at the bottom too and I do want my "top" different than my "bottom"

DBD
  • 23,075
  • 12
  • 60
  • 84
  • Are you using auto layout? If so, what constraints do you have on the tool bar? – rdelmar Feb 22 '13 at 19:26
  • Nope, not auto layout. Just the old auto resizing mask set via IB using the struts and springs. There it's fixed distance from left/top/right with a fixed height and a flexible width. – DBD Feb 22 '13 at 19:39
  • I can't duplicate your problem. I set it up with the springs and struts as you did, and it works fine. – rdelmar Feb 22 '13 at 21:33
  • Probably because it's not a simple view setup. My rootVC is a custom container for 2 child view controllers (as well as having some of it's own content). One of those children has a fairly simple `UIViewController` sub-class with a `UIToolBar` at the 0,0 position which goes from the left to right bounds of the view. So the the tool bar is at the top of the view, but it is not at the top of the screen. The overall look is similar to a `UISplitViewController` but there are significant enough differences which made using a `UISplitViewController` not an option. – DBD Feb 22 '13 at 22:02

1 Answers1

0

I eventually solved this using the UIBarPositioning protocol on UIToolBarand setting the barPosition = UIBarPositionTop

DBD
  • 23,075
  • 12
  • 60
  • 84