In iOS7, UIToolbar does not appear to have a little line (the shadow) on the top or bottom borders, which makes it difficult to distinguish from the rest of the app. How can I restore the shadow at the bottom of the toolbar when it is at the top of the screen?
EDIT: I should clarify that my toolbar is positioned at the top of the screen. After moving things around I realized that it IS drawing a shadow, but it's on the top, and therefore off-screen. What I want is for the shadow to appear at the bottom like a UINavigationBar.
This is because, by default, toolbars are attached to bottom, so the shadow line appears at the top (if they are at the bottom). You need to set the delegate of the toolbar and implement the following UIBarPositioningDelegate
method like so:
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar
{
return UIBarPositionTop; //or UIBarPositionTopAttached
}
I just ran into a case where a view was positioned between a top and bottom toolbar and configured to auto-resize to fill the space. However, it was layered above the bottom toolbar and the auto-resize made it cover the bottom toolbar's top shadow. The solution was to adjust the layering in Interface Builder so the toolbars were layered above the other views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With