【问题标题】:UIAlertViews disappear when calling UIActivityIndicatorView method调用 UIActivityIndi​​catorView 方法时 UIAlertViews 消失
【发布时间】:2010-08-27 11:06:42
【问题描述】:

如果我显示一个警报然后调用一个活动指示器的方法,警报就会消失,就像用户按下了确定一样。

警报声明:

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 Parser 获取错误的 URL,我注意到我的应用程序无法正常工作。目前我不能说活动指示器是否导致错误。

【问题讨论】:

    标签: iphone objective-c xcode


    【解决方案1】:

    您可以将 ActivityIndi​​cator 嵌入到警报视图中,看起来整洁: http://kwigbo.com/post/394670170/iphone-sdk-uialertview-with-activity-indicator

    编辑:重新阅读您的问题,上述解决方案可能不适合您的需求。

    让我问一下,你到底想用这两个视图做什么?

    【讨论】:

    • 如果出现错误,我会显示警报。但是,如果用户单击“确定”,则警报关闭,但导航栏中的活动指示器(右上方)仍在动画中。我想阻止它。我注意到我显示了两个警报(警报、停止动画、警报、停止动画)
    • 所以我不再有错误了,因为我修复了一些内存泄漏(僵尸)和一些其他错误(参见stackoverflow.com/questions/3591740/…)。该主题可以视为已关闭。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    相关资源
    最近更新 更多