当调用UIActivityIndicatorView方法时,UIAlertViews消失
问题描述:
如果我显示一个警报,然后调用一个活动指示器的方法,警报就会像用户按下OK一样消失。当调用UIActivityIndicatorView方法时,UIAlertViews消失
宣言警报:
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error loading content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];
活动指示灯宣言:
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
indicator.hidesWhenStopped = YES;
[indicator stopAnimating];
方法调用这会导致这样的问题:
[indicator stopAnimating];
我能做些什么?
编辑:我注意到我的应用程序不能正常工作,如果NSXML解析器得到一个错误的URL。目前我不能说活动指标是否导致错误。
答
你可以有嵌入在alertview的ActivityIndicator,看起来整洁: http://kwigbo.com/post/394670170/iphone-sdk-uialertview-with-activity-indicator
编辑:重读你的问题,上述方案可能不适合您的需求。
让我问,你究竟想用这两种观点来做什么?
如果出现错误,我会显示警报。但是,如果用户点击确定,警报关闭,但导航栏中的活动指示器(右上方)仍然具有动画效果。我想阻止它。我注意到我显示两个警报(警报,stopanimating,警报,stopanimating) – testing 2010-08-27 11:49:17
所以我没有错误了,因为我修复了一些内存泄漏(僵尸)和一些其他错误(请参阅http:// stackoverflow.com/questions/3591740/respondstoselector-send-to-deallocated-object)。这个话题可以被看作是封闭的。 – testing 2010-08-30 11:51:54