使用Xcode6在iOS中启动屏幕上的活动指示器

使用Xcode6在iOS中启动屏幕上的活动指示器

问题描述:

是否可以在Xcode6的启动画面中使用UIActivityIndi​​cator

Is it possible to use UIActivityIndicator in launch screen with Xcode6

我试过但它不是动画,不确定它是否可能。

I tried but its not animating, not sure whether its possible or not.

任何人都可以尝试这个或知道它是否可能吗?

Can anyone tried this or knows whether its possible or not?

谢谢 -

您要实现的目标是在启动屏幕中显示ActivityIndi​​cator,这是不可能的,但您可以通过某种不同的方式实现它。

What you are trying to achieve is to show ActivityIndicator during launch screen which is not possible, but you can achieve it by some different way.

以下是可以帮助您的想法:

Here is the idea that may help you:


  • 创建单独的加载页面&从App delegate中的didFinishLaunchingWithOptions方法调用它

  • 添加Splash图像&指标

  • 您可以设置2-3秒的计时器,而不是重定向到您的第一页应用

  • 使用指示灯时确保你已经检查过StartAnimating为true或者只是以编程方式添加指标如下:

  • Create separate loading page & call it from didFinishLaunchingWithOptions method in App delegate
  • Add Splash image & indicator to it
  • You can set timer of 2-3 seconds than redirect to your first page of app
  • While using indicator make sure you have checked StartAnimating to true or simply add indicator programmatically like this:

UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc]  initWithFrame:CGRectMake(225, 115, 30, 30)];

[activity setBackgroundColor:[UIColor clearColor]]; 

[activity setActivityIndicatorViewStyle: UIActivityIndicatorViewStyleGray];

[self.view addSubview: activity];

[activity startAnimating];


希望它适合你。