我想在alertView中添加一个活动指示器。 如何做到这一点?添加activityindicatorin alertVIew
2
A
回答
2
我想你可以通过这个做 -
UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"title" message:@"\n\n" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:nil];
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(130.0f, 50.0f, 20.0f, 20.0f)];
[activityIndicator startAnimating];
[alertview addSubview:activityIndicator];
[alertview show];
[alertview release];
[activityIndicator release];
1
检查教程here
2
UIAlertView *alert;
alert = [[[UIAlertView alloc] initWithTitle:@"Configuring Preferences\nPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[alert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(alert.bounds.size.width/2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
[indicator release];
相关问题
- 1. 添加一个AlertView在viewWillAppear,iPhone
- 2. 如何将操作添加到pushnotification alertview?
- 3. 当我在alertview上添加textview时,将TextView添加到UIAlertView
- 4. AlertView里面的alertView
- 5. 如何将TextField和CheckBox添加到相同的AlertView中
- 6. 添加的CollectionView或视图控制器来AlertView
- 7. 添加新窗口或查看在alertview点击按钮在iphone
- 8. alertView dismissModalViewControllerAnimated
- 9. 从alertview委托方法返回一个BOOL值: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- 10. 自定义AlertView - Xcode
- 11. 显示AlertView
- 12. 如何使用另一个AlertView显示AlertView
- 13. 警告上Alertview
- 14. AlertView打开Safari
- 15. 从AlertView按钮
- 16. 如何从alertview
- 17. 一个alertView示
- 18. 检测系统alertView willAppear/willDismiss
- 19. AlertView暂停代码
- 20. alertView didDismissWithButtomIndex不会在alertView的按钮上点击后调用
- 21. Alertview点击为UITableviewcontroller
- 22. 如何调整AlertView
- 23. 从UIView显示AlertView?
- 24. AlertView ButtonIndex不工作
- 25. 有没有一种方法可以在使用sdcalertview的alertview中添加tableview?
- 26. 多个AlertViews - 删除在另一个alertview后面的alertview
- 27. 传递NSIndexPath到alertView clickedButtonAtIndex
- 28. 在alertView回调问题popToRootViewControllerAnimated
- 29. UIView的功能与Alertview相似
- 30. 为什么这个alertView无?
您还需要释放activityIndicator。 – progrmr 2011-04-21 05:57:34
是的,我编辑了我的答案。 – saadnib 2011-04-21 07:18:43