I'm looking for a way, to automatically dismiss an alert view after some time or after a task is done. Is there a possibility? (or another way to开发者_如何学JAVA show a message for some time?)
You can call the -dismissWithClickedButtonIndex:animated:
method to dismiss the alert view.
To dismiss it automatically, create an NSInvocation and then use -performSelector:withObject:afterDelay:
to -invoke
it.
UIAlertView has a method called:
- ( void )dismissWithClickedButtonIndex: ( NSInteger )buttonIndex animated:( BOOL )animated
You can call it on your UIAlertView object to simulate a button press.
To dismiss it automatically after some time, you will need something like an NSTimer, to check if the alert view is still displayed, and in such a case, dismiss it.
精彩评论