While rotate to landscape some view on top shown because of status bar custom view in swift
Problem:
while rotate to landscape some view on top shown because i had added one custom view for status bar.How to avoid that?
Solution:
First you have to set the tag to the view that you are added for customisation.
Then follow the code.
override open func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if let statusView = self.view.viewWithTag(9999) {
statusView.isHidden = UIDevice.current.orientation.i
}
}
override var prefersStatusBarHidden: Bool {
return UIDevice.current.orientation.i
}
You can hide the view while from landscape then if it rotated to portrait it will automatically shown.
Comments
Post a Comment