#UIStatusBar
Explore tagged Tumblr posts
Text
Hiding the UIStatusBar in iOS7
The way to hide a UIStatusBar has changed in iOS7 making the ability to hide your status bar more dynamically.
Add method in your view controller (.m).
(BOOL)prefersStatusBarHidden { return YES; }
1 note
·
View note
Text
Managing Status Bar Styles
In this short tutorial you´ll learn how to change the status bar style within your application. This is quite easy, because you really need just a few lines of code.
- (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; }
This is the function of the type UIStatusBarStyle which allows us to change the style by returning the new style.
You can just return these styles:
return UIStatusBarStyleDefault;
Default equals black.
return UIStatusBarStyleLightContent;
Light equals white.
When the status bar style has changed within the above written code use this "call" to refresh the status bar:
[self setNeedsStatusBarAppearanceUpdate];
Please send me a mail if there is something unlogically or not understandable - [email protected].
Thank you!
0 notes
Text
UITableView tap status bar to scroll up
First we need to detect touches at status bar, and the only place (at least that i found) that we are able to detect is in AppDelegate.h.
So in the AppDelegate.h let's implement the touchesBegan:withEvent: selector and detect only tap if we are on top of status bar (mean y < 20)
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; CGPoint location = [[[event allTouches] anyObject] locationInView:[self window]]; if(location.y > 0 && location.y < 20) { [self touchStatusBar]; } }
Then let's implement the touchStatusBar selector in AppDelegate.h and create a notification to that selector.
- (void) touchStatusBar { [[NSNotificationCenter defaultCenter] postNotificationName:@"touchStatusBarClick" object:nil]; }
Now at your UITableViewController (or UIViewController) add and observer to this notification, best place is in viewDidLoad
- (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarHit) name:@"touchStatusBarClick" object:nil]; }
Finally scroll to top :)
- (void) statusBarHit { [[self tableView] setContentOffset:CGPointZero animated:YES]; }
0 notes