ios – Easy methods to hold UIView on high in UIKit

0
127


I am utilizing a UIView in UIKit to create a Toast-like performance in Android.

The tactic I used is ‘bringSubviewToFront’. Nonetheless, this methodology has an issue of not sustaining the unique place when switching the ViewController to tab, push, current.

So I used the strategy of including my very own UIView to the window.

guard let window = UIApplication.shared.home windows.final else { return }
window.addSubview(toastView)

On this approach, the UIView doesn’t disappear and stays displayed even when a push is carried out when the tab is switched. Nonetheless, The issue is that the UIView is hidden when presenting one other View Controller nonetheless exists.

After I add UIView from the highest view controller and dismiss the highest view controller, the added UIView behaves like Toast.

It means that there’s a downside of hiding solely when including UIView to Window and presenting one other View Controller, is there a option to resolve this downside?

I wish to hold UIView on the high of any state of affairs.

enter image description here