mairo
mairo

Reputation: 155

How to implement viewWillAppear() instead of deprecated didChangeStatusBarOrientationNotification in this case?

I would like to ask how shall I shall use viewWillTransitionToSize:withTransitionCoordinator: instead of deprecated 'didChangeStatusBarOrientationNotification'. Even though in Xcode https://github.com/Mairoslav/8.2.MeMe.2.0.rev it seems that all works well except of this warning I am curious how to silence this warning or make use of it.

I want that when orientation changes from portrait to landscape and back and forth the constraints do adjust accordingly as done via method @objc func orientationChanged.

Still this warning in question is within the Notification where method @objc func orientationChanged is called.

I tried to silence it via using nil for name: , however with nil for name there is an error.

The code in question:

override func viewDidLoad() {
    super.viewDidLoad()
    NotificationCenter.default.addObserver(self, selector: #selector(self.orientationChanged), name: UIApplication.didChangeStatusBarOrientationNotification, object: nil)
    
}

Upvotes: 0

Views: 180

Answers (0)

Related Questions