Skip to content

Instantly share code, notes, and snippets.

@MosheBerman
Created October 30, 2013 17:36
Show Gist options
  • Save MosheBerman/7236771 to your computer and use it in GitHub Desktop.
Save MosheBerman/7236771 to your computer and use it in GitHub Desktop.
iOS 6 margins on iOS 7
- (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