I'm trying to dismiss a UIActionSheet from the app delegate so that it doesn't show again when you return from background. I've tried to dismiss the action sheet from the viewDidUnload
or viewDidDisappear
methods in the subclass view controller, but that doesn't seem to get called when the app backgrounds.
Therefore, I'm trying to use the app delegate to dismiss either UIActionSheet
that may be showing when the app backgrounds. But I can't figure out what to call. Does anyone have a solution? Or a better idea to accomplish the same thing?
Thanks.
@Dylan what you can do is you can declare the property for your uiactionsheet variable and also synthesis it.
Then in appdelegate in applicationDidBecomeActive method you can dismiss that actionsheet by calling the dismiss method by doing something like this [viewController.actionSheet dismissWithClickedButtonIndex:0 animated:NO]
. Assuming that you have the reference in your appdelegate.
But if not then you can find all the UIViews shown on top of the uiwindow and then check if any of the uiviews is kind of class that is showing actionsheet. After that you can dismiss the actionsheet by doing the same as written above once you have the hold of that viewController that is showing actionsheet.
try to dismiss in applicationDidBecomeActive
method of appDelegate
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With