Skip to content

Instantly share code, notes, and snippets.

@Bayonetta
Created July 17, 2014 02:45
Show Gist options
  • Save Bayonetta/7455169202587a36d3d6 to your computer and use it in GitHub Desktop.
Save Bayonetta/7455169202587a36d3d6 to your computer and use it in GitHub Desktop.
Auto adjust the height of ViewController in iOS7
/*
iOS7中UIViewController新增的属性extendedLayoutIncludesOpaqueBars和edgesForExtendedLayout可以解决该问题。
其中这个属性指定了当Bar使用了不透明图片时,视图是否延伸至Bar所在区域,默认值时NO。
而edgesForExtendedLayout则是表示视图是否覆盖到四周的区域,默认是UIRectEdgeAll,即上下左右四个方向都会覆盖,
那么为让顶部不进行延伸到导航栏覆盖的区域,我们可以把顶部区域延伸去掉。
*/
self.extendedLayoutIncludesOpaqueBars = NO;
self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment