作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为 ViewController 的
,但是无论我是通过编程方式还是通过 InterfaceBuilder,它都会被忽略。 viewDidLoad()
中的 UITableView
设置 contentInsetAdjustmentBehavior == .never
这是我得到的。该图像是 TableView 的标题。
顺便说一下,我的导航栏位于透明的顶部。
我希望带图片的Header是这样的
任何帮助表示赞赏。谢谢
最佳答案
设置imageView的topConstraint常量为-64
声明一个变量 topPadding(针对 iPhone X)
@IBOutlet weak var topConstraint: NSLayoutConstraint!
var topPadding:CGFloat = 0.0
并在viewDidload中使用下面的代码
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController!.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController!.navigationBar.shadowImage = UIImage()
self.navigationController!.navigationBar.isTranslucent = true
topConstraint.constant = -64
if #available(iOS 11.0, *) {
let window = UIApplication.shared.keyWindow
topPadding = (window?.safeAreaInsets.top)!
topConstraint.constant = -(64+topPadding)
}
}
关于ios - contentInsetAdjustmentBehavior 从未设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52163301/
背景 我最近在 merge 期间遇到了一个意外未 merge 的文档文件的问题。 无论出于何种原因,我搞砸了 merge 并有效地删除了文件(和其他几个文件),因为我忘记了它们的存在。 现在我想查看我
我在我的网站上使用旧的 mysql 版本和 php 版本 4。 我的表结构: | orders_status_history_id | orders_id | orders_status_id |
我是一名优秀的程序员,十分优秀!