开发者

how to pop a transient dialog after an save action?

Hi just want to know how to add a transient dialog saying that action is performed.

like when user clicks save and you pop up saved and the window disappears itself in less than a secon开发者_高级运维d?

thanks advance


Use an action sheet like so:

/*  present a dialog  */
-(void)showDialog {
    loadingActionSheet = [[UIActionSheet alloc] initWithTitle:@"Something was saved!" delegate:nil  cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
    [loadingActionSheet showInView:self.view];
    [NSTimer scheduledTimerWithTimeInterval:1.5f target:self selector:@selector(closeActionSheet:) userInfo:nil repeats:NO];
}


/*  close the actionsheet  */
-(void)closeActionSheet:(id)sender {
    [loadingActionSheet dismissWithClickedButtonIndex:0 animated:YES];
}

Define UIActionSheet *loadingActionSheet; in your header, and use @property & @synthesize .

You will also need to implement UIActionSheetDelegate in your header.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜