Skip to content

Instantly share code, notes, and snippets.

@Kjuly
Created September 16, 2013 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kjuly/6576697 to your computer and use it in GitHub Desktop.
Save Kjuly/6576697 to your computer and use it in GitHub Desktop.
Note for iOS7.0.
/* Status Bar
*
* Related threads:
* - https://devforums.apple.com/message/867059#867059
* - https://devforums.apple.com/thread/199395?start=0&tstart=0
*
* The relevant messages to override are:
*/
- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation NS_AVAILABLE_IOS(7_0); // Defaults to
/*
* Layouts
*
* Related thread: https://devforums.apple.com/message/884707#884707
*/
NSMutableDictionary *views = ... // Some code here to add my views
// iOS 6 support - don't use top layout guide unless selector is present
NSString *topStr;
if ([self respondsToSelector:@selector(topLayoutGuide)]) {
[views setValue:self.topLayoutGuide forKey:@"topLayoutGuide"];
topStr = @"[topLayoutGuide]";
} else {
topStr = @"|";
}
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:[NSString stringWithFormat:@"V:%@-[mysubview]", topStr] options:0 metrics:nil views:views]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment