17

Is it possible to use UIActivityIndicator on the iOS launch screen?

I tried, but it's not animating.

Has anyone tried this or know whether it's possible?

pkamb
  • 33,281
  • 23
  • 160
  • 191
Zoeb S
  • 695
  • 1
  • 7
  • 21

3 Answers3

6

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:

  • 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];
    

Hope it will work for you.

Kampai
  • 22,848
  • 21
  • 95
  • 95
cyberlobe
  • 1,783
  • 1
  • 18
  • 30
5

You can't use animations on the Launch Screen.

If you want to do any animations on the "launch screen", instead use your first view controller as a splash view.

pkamb
  • 33,281
  • 23
  • 160
  • 191
madhu
  • 961
  • 9
  • 21
-8

Go to storyboard then select your ActivityIndicator and change the property to "Animating"

Rain
  • 231
  • 3
  • 12
  • 3
    You did not check this solution. And it is not working also technically speaking, because as stated above at the launchscreen your app is not yet running, so Launch Screen is more of a static image the system puts while preparing your app to run. – Fawkes Oct 06 '15 at 20:32