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

python - What's the Pythonic way to report nonfatal errors in a parser? -

angular - Converting AngularJS deffered promise to AngularX observable for JSOM -

php - curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to domain.com:443 -