【问题标题】:UIActivityIndicator not appearing in iOS 5UIActivityIndi​​cator 未出现在 iOS 5 中
【发布时间】:2012-04-19 06:56:26
【问题描述】:

我已经在我的应用程序中成功实现了活动指示器,在模拟器和设备上都可以正常工作。最近我将设备的操作系统从 4 升级到了 5。因为我看不到之前出现的活动指示器。

我的模拟器只支持到 OS 4.2,它可以正确显示活动指示器。在设备上它没有显示可能是因为 OS 5。

我已经使用 IB 来创建活动指标。

谢谢, 吉特什

【问题讨论】:

    标签: iphone ipad ios5 ios4 uiactivityindicatorview


    【解决方案1】:

    我猜hidesWhenStopped 属性设置为YES,并且活动指示器没有动画。

    要么将hidesWhenStopped 设置为NO(一直显示),要么确保调用:

    [self.activityIndicator startAnimating];
    

    【讨论】:

    • 它仍然没有显示在设备上
    【解决方案2】:

    只需检查样式属性,在某些情况下白色和灰色不起作用,就像在 ios 5 中,下面的样式对我来说是可行的。

    activityStyle = UIActivityIndicatorViewStyleWhiteLarge; 
    

    【讨论】:

    • 我在上面添加了一行,但它仍然没有在设备上显示它,在模拟器上它可以按我的意愿工作。
    【解决方案3】:

    希望这会奏效---

    UIActivityIndicatorView *activityIndicator; //declare it as globaly
    
       CGFloat width = 40;
        CGFloat height = 40;
        CGRect centeredFrame = CGRectMake(500, 150, width, height);
        activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:centeredFrame];
        activityIndicator.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
        [self.view addSubview:activityIndicator];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-21
      • 1970-01-01
      相关资源
      最近更新 更多