【发布时间】:2018-04-21 23:24:21
【问题描述】:
我将自定义按钮添加到我的标签栏,并附有 this 答案。
var menuButtonFrame: CGRect = menuButton.frame
//menuButtonFrame.origin.y = tabBar.frame.y + tabBar.frame.height - menuButtonFrame.height
menuButtonFrame.origin.y = view.bounds.height - menuButtonFrame.height
menuButtonFrame.origin.x = self.view.bounds.width / 2 - menuButtonFrame.size.width / 2
menuButton.frame = menuButtonFrame
menuButton.backgroundColor = Colors.mainColor
menuButton.layer.cornerRadius = menuButtonFrame.height/2
self.view.addSubview(menuButton)
当我在模拟器上进行测试时,它运行良好。但是当我在 Iphone X 模拟器上测试时,它显示在标签栏下。
我尝试将按钮 origin.y 值与标签栏底部(注释行)对齐,但它不再起作用。
我应该使用 iphone x 特定的对齐方式还是有更干净的解决方案。
【问题讨论】:
标签: ios iphone xcode xcode9 iphone-x