【问题标题】:show uiactivityview while an other operation is loading在加载另一个操作时显示 uiactivity 视图
【发布时间】:2010-09-13 14:10:14
【问题描述】:

我用谷歌搜索了几个小时,但我找不到一个代码示例,它描述了如何在加载操作/方法时显示 uiactivityview。

在我的情况下,我想在将大图像加载到 uiimageview 时显示它。你知道如何实现这一点吗?

提前致谢。
肖恩

【问题讨论】:

    标签: iphone ios4 selector uiactivityindicatorview


    【解决方案1】:

    您可能需要查看 UI UIActivityIndicatorView Class Reference 文档。

    确保在等待图像加载时返回运行循环,以查看活动指示器动画。此外,您可能需要创建一个方法来停止活动指示器,并可能通过从处理异步完成加载的任何方法执行 performSelectorOnMainThread 来调用该停止方法。

    【讨论】:

      【解决方案2】:

      这很容易。

      1. 显示活动指示器
      2. 启动线程加载该图像
      3. 如果加载了图像,线程会告诉 mainapp 终止活动指示器。

         NSThread detachNewThreadSelector:@selector(myMethod) 
      

      到目标:自己 withObject:nil];

            [self performSelectorOnMainThread:@selector(myMethod) 
                 withObject:nil 
                 waitUntilDone:false];
      

      会很有帮助。 取自http://www.iphoneexamples.com/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-10-15
        • 2016-11-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-21
        相关资源
        最近更新 更多