I need to display loaderView in top of the viewcontroller
let loaderView: UIView()
self.view.window?.addSubview(loaderView)
Other type:
let loaderView: UIView()
UIApplication.shared.keyWindow?.addSubview(loaderView)
Both line working fine, but Which code is best for adding subview... Thanks in advance....
Well if you are adding some view (not loader view) in your view controller on Appdelegate window then it's better to go with
UIApplication.shared.keyWindow?.addSubview(loaderView)
otherwise
self.view.window?.addSubview(loaderView)
is fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.