Use the below code to replace the original code in yourAppDelegate.m:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
SplashScreenVC *splashScreenVC = [[SplashScreenVC alloc] initWithNibName:@"SplashScreenVC" bundle:nil];
self.window.rootViewController = splashScreenVC;
[self.window makeKeyAndVisible];
}
In SplashScreenVC, import yourAppDelegate.h and add the below code:
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self performSelector:@selector(gotoRootVC) withObject:nil afterDelay:1.0];
}
-(void)gotoRootVC
{
SQLiteTutorialAppDelegate *delegate = (SQLiteTutorialAppDelegate *)[UIApplication sharedApplication].delegate;
delegate.window.rootViewController = delegate.tabBarController;
[delegate.window makeKeyAndVisible];
}
-(void)viewDidLoad
{
CGRect r = [UIScreen mainScreen].applicationFrame;
UIView *activityView = [[[UIView alloc] initWithFrame:r] autorelease];
self.view = activityView;
activityView.backgroundColor = [UIColor blackColor];
activityView.alpha = 0.5;
UIImageView *imgView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]] autorelease];
[activityView addSubview:imgView];
CGRect wheelR = CGRectMake(r.size.width / 2 - 12, r.size.height / 2 - 12, 24, 24);
UIActivityIndicatorView *activityWheel = [[UIActivityIndicatorView alloc] initWithFrame:wheelR];
activityWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
activityWheel.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
[activityWheel startAnimating];
[activityView addSubview:activityWheel];
}
No comments:
Post a Comment