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?

10
  • show here what you tried Commented Dec 17, 2014 at 5:56
  • I added UIActivityIndicator in Xib file and checked its animating property Commented Dec 17, 2014 at 5:58
  • are you able to see it when app running ? Commented Dec 17, 2014 at 5:59
  • Yes am able to see, but its not animating Commented Dec 17, 2014 at 6:00
  • You have to set property startAnimating. Or in Storyboard check mark behaviour = Animating. Commented Dec 17, 2014 at 6:02

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That's what I would do
Pay attention that the launch image is on full screen and if you use for example navigation controller, you might have issues with it.
I like doing this method, especially when the initial screen changes from launch to launch
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.

Comments

-8

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

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.