0
votes

I have added splash screen by doing project->General tab-> Launch Images->

From here i have taken two images according to the size and its working very fine too.

Now i want to put an Activity Indicator onto it.

So before loading of my DB and files, the splash as well as the indicator should be displayed.

What can i do for this?

I also tried after some suggestions

i did like this

[self performSelector:@selector(loadingViewFade) withObject:nil];

  • (void) loadingViewFade

    loadingView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)]; loadingView.image = [UIImage imageNamed:@"splashscreen_640x960"]; [_window addSubview:loadingView]; [_window bringSubviewToFront:loadingView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:3.0]; [UIView setAnimationDelay:3.0]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:_window cache:YES]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; loadingView.alpha = 0.5f; [UIView commitAnimations];

    //Create and add the Activity Indicator to loadingView UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; activityIndicator.alpha = 1.0; activityIndicator.center = CGPointMake(160, 430); activityIndicator.hidesWhenStopped = NO; UILabel *text = [[UILabel alloc]initWithFrame:CGRectMake(140, 435, 160, 30)]; text.backgroundColor = [UIColor clearColor]; text.textColor = [UIColor whiteColor]; text.font = [UIFont systemFontOfSize:14]; text.text = @"Loading..."; [loadingView addSubview:text]; [loadingView addSubview:activityIndicator]; [loadingView addSubview:activityIndicator]; [activityIndicator startAnimating];

(void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context

[loadingView removeFromSuperview];

Again the splash as well as the indicator isnt displaying rather the default screen is being loaded untill the database loads.. Please help me out

2

2 Answers

0
votes

I think you should create your own splash screen, and add a UIActivityIndicator to this splash screen by programmatically.

0
votes

project->General tab-> Launch Images-> will add the default splash or loading screen to your project. You can not show activity indicator on the default image. To show loading message to Activity indicator you need to add your splash view controller which has the background image as default image which you set before. Also one Activity indicator to show the loading status. Once you are done with loading of database and other thing stop animating activity indicator and dismiss the splash screen.