0

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 Answers 2

0

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

0

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.

3
  • so i have to add the splashscreen before the db loads right? and i have to add an activity indicator onto the splash screen..activity indicator should be the subview to splashview right? Apr 28, 2014 at 11:18
  • and how can i know whether the database loads completely.Because basing on that i have to leave the splash view controller and navigate to home screen right? Apr 28, 2014 at 11:27
  • Search about it Grand Central Dispatch. This will help you
    – svrushal
    Apr 28, 2014 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.