Skip to content

Instantly share code, notes, and snippets.

@yoshimax
Created October 14, 2013 08:10
Show Gist options
  • Select an option

  • Save yoshimax/6972474 to your computer and use it in GitHub Desktop.

Select an option

Save yoshimax/6972474 to your computer and use it in GitHub Desktop.
Inset for iOS7
- (void)orientationChanged:(NSNotification *)notification {
NSLog(@"%s", __func__);
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame];
float statusBarHeight = (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) ? statusBarViewRect.size.width : statusBarViewRect.size.height;
float heightPadding = statusBarHeight + self.navigationController.navigationBar.frame.size.height;
[self.tableView setContentInset:UIEdgeInsetsMake(heightPadding, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment