本文介绍了如何设置UIViewController“扩展边缘”性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Storyboard中看到以下选项,用于在navBars / tabBars下扩展UIViewController视图的边缘:

I see the following selections in Storyboard for extending the edges of a UIViewController's view under navBars/tabBars:

但是如何在代码中为我的所有ViewControllers全局设置这些属性?而不是手动检查/取消选中Storyboard中的每个ViewController。

But how do I set these properties globally for all of my ViewControllers in code? As opposed to manually checking/unchecking on every ViewController in Storyboard.

推荐答案

iOS7中有几个新属性来控制这些设置。

There is a couple of new properties in iOS7 to control those settings.

edgesForExtendedLayout 告诉应该扩展哪些边(左,右,上,下,全,无或任何组合)。延伸底部边缘等于Under Bottom Bars勾选,延伸顶部边缘等于Under Top Bars勾选。

edgesForExtendedLayout tells what edges should be extended (left, right, top, bottom, all, none or any combination of those). Extending bottom edge equals "Under Bottom Bars" tick, extending top edge equals "Under Top Bars" tick.

extendedLayoutIncludesOpaqueBars 告诉边缘是否应该在不透明条形下自动延伸。因此,如果将这两个设置组合在一起,则可以模拟代码中任何界面构建器刻度的组合。

extendedLayoutIncludesOpaqueBars tells if edges should be automatically extended under the opaque bars. So if you combine those two settings you can mimic any combination of interface builder ticks in your code.

这篇关于如何设置UIViewController“扩展边缘”性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 14:56