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

时间:2010-12-08 22:41:37

标签: iphone dialog

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

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

感谢提前

1 个答案:

答案 0 :(得分:2)

使用如下的操作表:

/*  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