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

问题描述

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

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

但是如何在代码中为我的所有 ViewController 全局设置这些属性?与在 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-11 19:11