I have this ViewController that adds a titleView
to it's navigationItem
on viewDidLoad
:
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
}
This use to work fine on all the phones, but since updating to iOS 13, now the iPhone 8 duplicates this image:
This only happens on iPhone 8, all other phones it looks correct. I've tried this on both simulator and physical and the results are consistent across both types of devices...
Any idea on why iPhone 8 duplicates the image?