Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS7 UIStatusBar blur not correct

I am using a UIToolbar for the controls at the top of the screen (There is no navigation controller) The toolbar has the look I want, however the status bar is entirely clear. I cannot seem to mimic the blur that the UIToolbar has in it's transparency. Has anyone come across a solution to this that does not involve using a navigation controller?

Scroll content behind status bar

Scroll no content behind status bar

like image 944
Kyle Avatar asked Sep 20 '13 15:09

Kyle


1 Answers

UIBarPosition demo

In Order to achieve this you need to implement methods in the UIBarPositioningDelegate protocol:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarPositioningDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIBarPositioningDelegate

Here is the code:

@interface ViewController : UIViewController <UIToolbarDelegate>

@property (nonatomic, weak) IBOutlet UIToolbar * toolbar;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    //we become the delegate
    self.toolbar.delegate = self;
}

-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar{
    //this tells our bar to extend its background to the top.
    return UIBarPositionTopAttached;
}

@end
like image 189
Saltymule Avatar answered Oct 06 '22 07:10

Saltymule