iphone – 如何在保存操作后弹出瞬态对话框?

您只想知道如何添加一个瞬态对话框,说明已执行操作.

比如当用户点击保存并弹出保存并且窗口在不到一秒的时间内自动消失?

谢谢你

最佳答案 使用如下的操作表:

/*  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];
}

定义UIActionSheet * loadingActionSheet;在你的标题中,并使用@property& @synthesize.

您还需要在标题中实现UIActionSheetDelegate.

点赞