- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在单击 TableView 上的按钮时显示弹出窗口,使用 SCLAlertView-Swift图书馆。
我还尝试定义约束,以便旋转设备时尺寸正确。但是,它给了我以下错误:
'UIViewLayoutMarginsGuide'.leading"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'
我想我正在尝试从 TableViewController 获取 View ,因为我从该类调用此代码。
let alert = SCLAlertView()
alert.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
let margins = view.layoutMarginsGuide
alert.view.leadingAnchor.constraint(equalTo: margins.leadingAnchor).isActive = true
alert.view.trailingAnchor.constraint(equalTo: margins.trailingAnchor).isActive = true
alert.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 8).isActive=true
alert.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 8).isActive=true
alert.showInfo("Login", subTitle: "")
为什么它说我引用了不同 View 层次结构中的项目?我该怎么做才能解决这个问题?
提前谢谢您。
最佳答案
查看 SCLAlertView
的实现 here ,它似乎是作为 UIApplication.shared.keyWindow
的 subview 添加的。
我建议将约束挂接到应用程序的 UIWindow
上,而不是 TableViewController
的 View 上。
let rv = UIApplication.shared.keyWindow! as UIWindow
let margins = rv.layoutMarginsGuide
关于ios - 使用弹出库时的不同 View 层次结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40961010/
我正在尝试将多个水平链接的 Button 和 TextView 垂直链接为 View 集,但仍保持平面 View 层次结构。这是我的初始布局和代码:
到目前为止,我已经在Google BigQuery上训练了几种模型,目前我需要查看模型的外观(即架构,损失函数等)。 有没有办法获取这些信息? 最佳答案 仔细阅读文档后,我可以说该功能尚不存在。我什至
本文实例讲述了PHP实现二叉树深度优先遍历(前序、中序、后序)和广度优先遍历(层次)。分享给大家供大家参考,具体如下: 前言: 深度优先遍历:对每一个可能的分支路径深入到不能再深入为止,而且每个
我是一名优秀的程序员,十分优秀!