Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 standard control to do this? I've seen apps do this. A rounded rectangle, dark and partially transparent with text inside. It does not ask for user input but disappears on its own in some short period of time. Android has a similar construct which is standard. Also similar to the windows displayed by Growl.

Suggestions appreciated.

like image 853
David Avatar asked Sep 17 '10 18:09

David


People also ask

How do I get message notifications on my iPad?

You can turn app notifications on or off, have notifications play a sound, choose how and where you want app notifications to appear when your device is unlocked, and more. Go to Settings > Notifications. To schedule a notifications summary, tap Scheduled Summary, then turn on Scheduled Summary.

How can I get notifications on my iPhone without unlocking?

To show the contents of notifications on the Lock Screen without unlocking your device, go to Settings > Notifications > Show Previews, and select Always.

How do I see notifications on my iPhone after disappearing?

Unfortunately, there is no way to view notifications once you've deleted them. If you delete, clear, or open one, it will no longer appear on your iPhone's lock screen, and there's no way to retrieve it.

How do I get notifications on my iPad from my iPhone?

Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style you want. If you've turned on Allow Notifications, you can choose when you want the notifications to be delivered – immediately or in the scheduled notification summary.


2 Answers

There is a user library on cocoacontrols.com that emulates the Android-style Toast pop-ups. Might be what you are looking for.

http://www.cocoacontrols.com/platforms/ios/controls/altoastview

There's also this one that follows the same idea.

http://www.cocoacontrols.com/platforms/ios/controls/itoast

like image 123
Joe Masilotti Avatar answered Sep 16 '22 17:09

Joe Masilotti


Create a class that inherits from UIAlertView. In your constructor just call [super init] and then add any view you want as a subview. You can even design this view in Interface Builder. Something like this:

- (id)initWithMessage:(NSString *)message dismissAfter:(NSTimeInterval)interval {   if ((self = [super init]))   {      CustomView * customView = [[[CustomView alloc] init] autorelease]; // or load from NIB      [self addSubview:customView];      [self performSelector:@selector(dismissAfterDelay) withObject:nil afterDelay:interval];   }   return self; }  - (void)dismissAfterDelay {   [self dismissWithClickedButtonIndex:0 animated:YES];  } 

To display your custom alert view just init it, and call show as with a regular UIAlertView.

CustomAlertView * cav = [[CustomAlertView alloc] initWithMessage:@"Doing Something]; [cav show]; [cav release]; 

As an nice side-effect, when you present this view the background will darken and you will get the nice wobbly animation for any alert view.

like image 30
Marco Mustapic Avatar answered Sep 20 '22 17:09

Marco Mustapic