Created
September 16, 2013 04:27
-
-
Save Kjuly/6576697 to your computer and use it in GitHub Desktop.
Note for iOS7.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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