How to display temporary popup message on iPhone/iPad/iOS

后端 未结 10 993
孤城傲影
孤城傲影 2020-12-04 11:31

I\'d like to display a temporary message on the iPhone/iPad displaying confirmation of an action, or some quick status about some background activity.

Is there a st

10条回答
  •  爱一瞬间的悲伤
    2020-12-04 11:54

    Use UIAlertView. Here's a quick link to a simple example:

    UIAlertView

    Edited: Sorry, didn't see about disappearing on it's own. I think you need to have some confirmation by users of messages received. UIAlertView pretty much accomplishes that. Not sure if you have it gradually fade away unless you're in an app with a view that has a timer or event based delay that will show a view and then eventually remove it.

    Second edit: Found a way to implement it. You can manually call the dismiss function after some set time that you've designated. (Sorry for the messy post) It would look something like this:

    //Create UIAlertView alert
    alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Some message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
    
    //After some time
    [alert dismissWithClickedButtonIndex:0 animated:TRUE];
    

提交回复
热议问题