我想在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. 如何將操作添加到pushnotification alertview?
- 2. 在alertView中添加亂舞查看
- 3. 添加Alertview與在圖形頁面
- 4. 如何在AlertView中添加UIActivityIndicatorView
- 5. 添加一個AlertView在viewWillAppear,iPhone
- 6. 當我在alertview上添加textview時,將TextView添加到UIAlertView
- 7. AlertView裏面的alertView
- 8. 添加新窗口或查看在alertview點擊按鈕在iphone
- 9. 添加的CollectionView或視圖控制器來AlertView
- 10. 將文本添加到Alertview文本框中iOS
- 11. 如何將TextField和CheckBox添加到相同的AlertView中
- 12. alertView dismissModalViewControllerAnimated
- 13. 從alertview委託方法返回一個BOOL值: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- 14. 自定義AlertView - Xcode
- 15. 顯示AlertView
- 16. 當alertview存在時alertview存在
- 17. 的UITextField - 上AlertView
- 18. 如何使用另一個AlertView顯示AlertView
- 19. 的WebView/AlertView
- 20. 警告上Alertview
- 21. 從AlertView按鈕
- 22. 一個alertView示
- 23. 如何從alertview
- 24. NSUserDefaults和alertView
- 25. AlertView打開Safari
- 26. 檢測系統alertView willAppear/willDismiss
- 27. iOS alertview操作按鈕
- 28. AlertView暫停代碼
- 29. AlertView iOS 7內的UiTableView
- 30. JSON /表格視圖/ UI AlertView
您還需要釋放activityIndicator。 – progrmr 2011-04-21 05:57:34
是的,我編輯了我的答案。 – saadnib 2011-04-21 07:18:43