Activity Indicator on launch screen in iOS using X

2019-02-12 18:35发布

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?

Thanks-

3条回答
爷、活的狠高调
2楼-- · 2019-02-12 19:10

You can't able to code animations on Launch screen...if you want to do any animations on launch screen...use your first view controller as splash view...

查看更多
不美不萌又怎样
3楼-- · 2019-02-12 19:13

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.

查看更多
爷、活的狠高调
4楼-- · 2019-02-12 19:14

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

查看更多
登录 后发表回答