开发者

Is there a way to dismiss an alertview automatically after some time?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜