Animating Activity Indicator on iOS launch screen
Asked Answered
J

3

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?

Jeanettajeanette answered 17/12, 2014 at 5:55 Comment(10)
show here what you triedHoyos
I added UIActivityIndicator in Xib file and checked its animating propertyJeanettajeanette
are you able to see it when app running ?Hoyos
Yes am able to see, but its not animatingJeanettajeanette
You have to set property startAnimating. Or in Storyboard check mark behaviour = Animating.Concessionaire
@Hoyos have you used launch screen in Xcode6 ?Jeanettajeanette
I did @Kampai Its working on other screen but not on launch screenJeanettajeanette
@Hoyos have you tried UIActivityIndicator on launch screen?Jeanettajeanette
What I guess is launch screen takes very short time to load, I think launch screen complete its execution before activity view is start animating.Concessionaire
@ZoebS try this: #6849572Hoyos
H
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.

Hoyos answered 17/12, 2014 at 6:48 Comment(3)
That's what I would doPiracy
Pay attention that the launch image is on full screen and if you use for example navigation controller, you might have issues with it.Kei
I like doing this method, especially when the initial screen changes from launch to launchSells
H
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.

Halloween answered 17/12, 2014 at 8:6 Comment(0)
O
-8

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

Orme answered 9/9, 2015 at 1:29 Comment(1)
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.Avaavadavat

© 2022 - 2024 — McMap. All rights reserved.