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

go - serving up pdfs using golang -

python - Best design pattern for collection of objects -

r - Using `bbmle:mle2` with vector parameters (already works using `optim`) -