I am using LaunchScreen.storyboard
for showing the splash screen which is just a static image. Now the problem is i want to show an alert on the top of this splash screen if a particular condition is not met . For this i did the following code . But unfortunately the alert is shown only after the splash screen. How can i show the alert on the top of splash screen? As of now this is the following code which I am implementing but the splash screen does not shows the alert instead it shows only after the splash screen.
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
if conditionMet
{
print("Condition met!")
}
else
{
let storyboard : UIStoryboard = UIStoryboard(name: "Launch Screen", bundle: nil)
let launchScreenCtrler = storyboard.instantiateViewController(identifier: "LAUNCH_SCREEN")
let alertViewFrame = CGRect(x: 100, y: 300, width: 120, height: 80)
let newView : UIView = UIView(frame: alertViewFrame)
launchScreenCtrler.view.addSubview(newView)
launchScreenCtrler.view.bringSubviewToFront(newView)
alert.show(launchScreenCtrler, sender: newView)
}
}
You can't control what is visible over Launch Screen
or for how much time it is displayed.
Here's what you should do -
SplashViewController
that has identical layout as LaunchScreen.storyboard
.SplashViewController
is the first screen to be visible to user in the app.