If I get an alert in my application and if I put application in background and press application icon to enter the application, a splash screen is displayed and then the alert pop up. Why splash screen appears? And if alert is not present and I put application in background and press application icon to enter the application, splash screen is not displayed.
5 Answers
First you have to make the UIAlertView
a property in your class.
In your AppDelegate Class you can implement the applicationDidEnterBackground:
Method in wich you can put something like this:
[yourViewController.yourAlert dismissWithClickedButtonIndex:0 animated:NO];
This should dismiss the alert if your app enters the background. Hope this helps!

- 1,897
- 2
- 21
- 34
-
if i have multiple alertview, how can i close them? Any idea? @pmk – Anilkumar iOS - ReactNative Dec 05 '14 at 09:48
The splash screen is as @akshay1188 mentions, is the Default.png
in your project file. The reason for it being displayed, based on my best assumption, is because the OS has not managed to take a screenshot of your App before you go back to it. See this answer to a StackOverflow question where it was discussed.
As for the UIAlertView
, @pKoul's anwser got my upvote.

- 1
- 1

- 1,167
- 10
- 22
If you want to dismiss all AlertViews programmatically you have to Remember a Reference to the currently shown Alterviews. I recommend a Singleton class where you ask for an AlertView and wich saves a Reference to the AlertView.
then you could use the
`- (void)applicationDidEnterBackground:(UIApplication *)application`
in your AppDelegate and call a Function on the Singleton Class, wich itself calls
[alert dismissWithClickedButtonIndex:0 animated:YES];
at all Alertviews.

- 5,198
- 1
- 19
- 28
-
Now alert is not displayed when I enter the application but splash screen does. – sam Jan 06 '12 at 09:04
-
I guess you Implemented as I recommended you? If yes: How do you show your Splashscreen? – Dennis Stritzke Jan 06 '12 at 09:58
Maybe you can use the notification posted UIApplicationDidEnterBackgroundNotification in any class that needs some cleanup before entering bg. Do not forget to remove the observer in dealloc.
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(cleanup:)
name: UIApplicationDidEnterBackgroundNotification
object: nil]

- 1,491
- 11
- 11
The splash screen is actually the launch image that you might be using as Default.png

- 1,647
- 2
- 17
- 35