【发布时间】:2012-06-29 14:00:34
【问题描述】:
如果用户单击 uialertview 上的某个按钮,我有一个耗时的步骤要做。我想在完成时用活动指示器通知用户。我不确定要获得所需的输出究竟需要做什么。这是流程:
用户点击按钮 1“建造塔”。
UIAlertview 显示“你想这样做吗,这需要时间”
用户点击“是”: 现在我在 alertview Delegate 方法中。
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {//Yes the user wants to do this
//Show activity indicator here
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alertView addSubview:indicator];
[indicator release];
//
[SimpleFunctions doThatMethodThatTakesALongTime];
//remove activity indicator here
}
}
在这里,我想在“大处理”完成之前显示一个活动指示器。
向 alertview 添加活动指示器的示例展示了如何将指示器添加到上述警报视图。但我不希望该指示器出现,直到用户单击“是”。 关于如何实现这一目标的任何指示都会很棒。我希望我把问题说清楚了,如果没有,请告诉我,
谢谢
【问题讨论】:
-
你想在你的第一个警报上显示活动指示器还是当你点击警报并且它进入委托时...有点混乱让你的问题更清楚
-
您好,感谢您的回复。我希望活动指示器仅在用户在警报中按下是时才显示 - 而不是在第一个警报中。我将用括号编辑我的问题以使其更清楚。
标签: iphone uialertview uiactivityindicatorview