Created
October 30, 2013 17:36
-
-
Save MosheBerman/7236771 to your computer and use it in GitHub Desktop.
iOS 6 margins on iOS 7
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
- (void)applyLegacyBoundries | |
{ | |
/* In iOS 7, UIKit will automatically | |
* put content beneath navigation bars. | |
* It also tries to pad scroll views | |
* and table views to make them | |
* scroll nicely beneath them. | |
* | |
* These two checks will fix them. | |
* | |
* For iOS 6 compatibility, we need to | |
* check if the view controller class | |
* actually responds to the relevant | |
* methods. (If not, we'll crash | |
* when calling them.) | |
*/ | |
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { | |
[self setEdgesForExtendedLayout:UIRectEdgeNone]; | |
} | |
if ([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)]) { | |
[self setAutomaticallyAdjustsScrollViewInsets:NO]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment