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
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.