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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -