- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果有人能展示如何使用 iOS 7 中引入的 UITableViewController 的 topLayoutGuide 和 bottomLayoutGuide 属性,我将不胜感激。谢谢。
最佳答案
topLayoutGuide
和 bottomLayoutGuide
属性继承自 UIViewController并实现 UILayoutSupport协议(protocol)。它们被设计用于 AutoLayout
, 但也可以不使用 AutoLayout
直接使用.
在 topLayoutGuide
的情况下,该属性指示您不希望出现在半透明或透明 UIKit 栏(例如状态栏或导航栏)后面的内容的最高垂直范围。因此,如果您的 View Controller 已被推送到 UINavigationController
堆栈,topLayoutGuide
会告诉你从屏幕顶部多少点状态栏和导航栏覆盖。您可以在 UIScrollView
中使用此值滚动内容到导航栏的正下方或确保 View 中的其他内容未被 UINavigationBar
覆盖.
请记住 topLayoutGuide
的值取决于 View Controller 以及它是否包含在另一个 View Controller 中。来自 Apple 的 UIViewController
文档:
The object that constrains the value for this property depends on whether or not the view controller is a child of a container view controller (such as a navigation or tab bar controller), as follows:
• A view controller not within a container view controller constrains this property to indicate the bottom of the status bar, if visible, or else to indicate the top edge of the view controller's view.
• A view controller within a container view controller does not set this property's value. Instead, the container view controller constrains the value to indicate:
The bottom of the navigation bar, if a navigation bar is visible
The bottom of the status bar, if only a status bar is visible
The top edge of the view controller’s view, if neither a status bar nor navigation bar is visible
UITextField
的一段代码响应键盘的显示。我将文本字段移动到导航栏的正下方。
CGFloat length = self.topLayoutGuide.length;
_feedback.frame = CGRectMake(_feedback.frame.origin.x, length + 5.0, _feedback.frame.size.width, _feedback.frame.size.height);
bottomLayoutGuide
就像使用
topLayoutGuide
,除了
bottomLayoutGuide
指内容的最低垂直范围。
关于uitableview - topLayoutGuide 和 bottomLayoutGuide UIViewController 属性示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17959224/
我有一个支持 iPhone 上每个方向的 viewController (mainView)。 从这个 View 中,另一个 viewController 以模态样式呈现,它仅支持纵向方向(并相应地强
由于我试图“正确地”实现 iAds(即共享 ADBannerView 的单个实例),我在 UIViewController 中以编程方式创建了一个 UITableView 并将其添加到 View 中。
我正在编写一个自定义 UIViewController,它将具有类似标签栏的功能(包含用于在 subview 之间切换的控件)。添加子 Controller 时,我还将 subview 添加到容器 V
我有一个 View ,我希望它看起来像这样: |---------------| | | ", "" ) 看来我需要一些帮助。如何正确地做到这一点?我不想在 UIV
我在使用 topLayoutGuide 方法时遇到了奇怪的问题,我必须在 setAutomaticallyAdjustsScrollViewInsets: 不起作用的情况下使用它。为了缩小问题的原因,
我有一个用于呈现 View Controller 的自定义转换,并使用 UIPresentationController 子类来执行呈现。 在演示 Controller 中,我向其 container
我有一个问题,UIViewController(来自 XIB)中的 topLayoutGuide.length 在 viewWillAppear 之后设置,我不知道如何 Hook topLayoutG
我有一个简单的 View Controller 层次结构,其中一个 View Controller 使用 UINavigationController 显示。在 viewDidLoad 中,它设置了带
我有一个带有半透明状态栏和导航栏的 UIPageViewController。正如预期的那样,它的 topLayoutGuide 是 64 像素。 但是,UIPageViewController 的
如果有人能展示如何使用 iOS 7 中引入的 UITableViewController 的 topLayoutGuide 和 bottomLayoutGuide 属性,我将不胜感激。谢谢。 最佳答案
我正在使用 Swift2.1,我想在我的 View Controller View 中添加一个 subview ,它在屏幕顶部有一个导航栏。所以我尝试设置subview.top等于self.topLa
我正在学习通过代码在 VFL 中编写约束 我的 View 水平居中: let constraintY = NSLayoutConstraint.constraintsWithVisualFormat(
Apple 的 documentation关于在 View 和布局指南之一之间创建自动布局约束仅显示使用 VFL 的示例. 有没有办法不VFL(使用NSLayoutConstraint's other
我一直在尝试创建一个容器 View Controller ,它提供一些覆盖 View ,如 UINavigationController 和 UITabBarController 为 iOS 7 中的
我的 ViewController 嵌入在 UINavigationController 中,它有一个 view 应该与 Root View 的顶部对齐。 Root View 具有深灰色背景,并占据全
例如,我制作了一个类似于 UINavigationController 的自定义容器 View Controller ,但它的顶部有 2 个导航栏。 然后,在 subview Controller 中
我正在实现一个自定义容器,它与 UINavigationController 非常相似,只是它不包含整个 Controller 堆栈。它有一个 UINavigationBar,它被限制在容器 Cont
UIViewController 的 topLayoutGuide 和 bottomLayoutGuide 在 iOS 11 中已弃用。应该替换什么? 最佳答案 以前在您的 UIViewControl
我有一个 UIViewController 显示另一个 UIViewController。两个 View Controller 都使用带有自动布局的 topLayoutGuide 和 bottomLa
使用今天下载的 XCode 5。 iOS 7。当我运行应用程序时,表格 View 标题出现在导航栏下方,我不介意它在导航栏下方滚动,但我希望它最初看起来畅通无阻。我想弄清楚如何使用 iOS 7 转换指
我是一名优秀的程序员,十分优秀!