Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove UIToolbar hairline in iOS 7

Tags:

ios7

In iOS 7, Apple has changed UIToolbar to display a 1px hairline at its top. This is visually distracting in some cases, and there does not seem to be any public API to remove it.

Setting a shadowImage does not work.

I am looking for a way of removing the hairline in a relatively clean way, and keep the ordinary background blur.

like image 467
fzwo Avatar asked Oct 01 '13 07:10

fzwo


2 Answers

If you set youBar.clipsToBounds = YES, the hairline disappear.

Hope this help.

[EDIT]

For the navigationBar bottom hairline, the solution here https://stackoverflow.com/a/18180330/2011578 also works great.

like image 73
cire.boroguies Avatar answered Oct 04 '22 02:10

cire.boroguies


The hairline border is a UIImageView subview of the toolbar, you can hide it like this:

        for (UIView *subView in [self.toolbar subviews]) {             if ([subView isKindOfClass:[UIImageView class]]) {                 // Hide the hairline border                 subView.hidden = YES;             }         } 
like image 44
tinrocket Avatar answered Oct 04 '22 02:10

tinrocket