Ios 导航项目标题视图在iPhone 8上出现两次
我有一个ViewController,它在Ios 导航项目标题视图在iPhone 8上出现两次,ios,swift,uinavigationbar,Ios,Swift,Uinavigationbar,我有一个ViewController,它在viewDidLoad上的navigationItem中添加一个titleView: override func viewDidLoad() { super.viewDidLoad() self.navigationItem.titleView = self.navigationLogo() } /** Navigation Logo */ func navigationLogo() -> UIView { let
viewDidLoad
上的navigationItem
中添加一个titleView
:
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.titleView = self.navigationLogo()
}
/**
Navigation Logo
*/
func navigationLogo() -> UIView {
let logoView = UIView(frame: CGRect(x: 0, y: 0, width: (self.navigationController?.view.frame.width)! * 0.9, height: 44))
let imageView = UIImageViewAligned(frame: CGRect(x: 5, y: 5, width: logoView.frame.width - 10, height: logoView.frame.height - 10))
imageView.contentMode = .scaleAspectFit
switch YTPAppManager.language {
case .arabic:
if self.navigationController?.viewControllers.firstIndex(of: self)! == 0 {
imageView.frame = CGRect(x: -30, y: 5, width: logoView.frame.width - 10, height: logoView.frame.height - 10)
} else {
imageView.frame = CGRect(x: -78, y: 5, width: logoView.frame.width - 10, height: logoView.frame.height - 10)
}
imageView.image = #imageLiteral(resourceName: "ytp_logo_ar")
imageView.alignRight = true
case .english:
imageView.image = #imageLiteral(resourceName: "ytp_logo")
imageView.alignLeft = true
}
logoView.addSubview(imageView)
return logoView
}
这在所有手机上都可以正常使用,但自从升级到iOS 13后,现在iPhone 8复制了这幅图像:
这只发生在iPhone8上,所有其他手机看起来都是正确的。我在模拟器和物理设备上都试过,结果在两种类型的设备上都是一致的
你知道为什么iPhone8会复制这个图像吗?我在不同的设备上也遇到了同样的问题……类似的错误,也许,对吧?