swift - Which one is best in "self.view.window?.addSubview()" or "UIApplication.shared.keyWindow?.addSubview()" in iOS -


i need display loaderview in top of viewcontroller

let loaderview: uiview() self.view.window?.addsubview(loaderview) 

other type:

let loaderview: uiview() uiapplication.shared.keywindow?.addsubview(loaderview) 

both line working fine, code best adding subview... in advance....

well if adding view (not loader view) in view controller on appdelegate window it's better go with
uiapplication.shared.keywindow?.addsubview(loaderview)

otherwise

self.view.window?.addsubview(loaderview)

is fine.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -