以编程方式禁用Alertview

时间:2011-11-29 09:03:19

标签: iphone objective-c ios

我想在没有按钮的AlertView中显示活动指示器,我想在活动指示停止动画时禁用它。

3 个答案:

答案 0 :(得分:1)

只需为UIAlertView调用dismissWithClickedButtonIndex:animated:方法

[alertView dismissWithClickedButtonIndex:0 animated:YES];

答案 1 :(得分:1)

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[alert addSubview:progress];
[progress startAnimating];
[alert show];
[progress release];

然后关闭警报视图和微调器:(您需要将警报视图作为成员)

[alert dismissWithClickedButtonIndex:0 animated:YES];
[alert release];

答案 2 :(得分:0)

只需致电:

[theAlertViewInstance dismissWithClickedButtonIndex: 0 animated:YES];

这应该做,你需要什么。