I get 2 different images instead of a splash screen

I get another image at the beginning of the application, like a splash screen, then I get my actual image, which I placed in the encoding. I posted a splash screen with the following code in didFinishLaunchingWithOptions:

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window.rootViewController = self.tabBarController; self.tabBarController.delegate=self; [window addSubview:tabBarController.view]; [self.window makeKeyAndVisible]; LoginViewController *vc = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; self.loginNav = [[UINavigationController alloc] initWithRootViewController:vc]; NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; if([userDefaults valueForKey:@"UserName"] &&[userDefaults valueForKey:@"Password"]) { vc.username=[userDefaults valueForKey:@"UserName"]; vc.password=[userDefaults valueForKey:@"Password"]; vc.autoLogin=YES; [vc loginSelectorMethod]; } else { [self.window addSubview:self.loginNav.view]; [self.window makeKeyAndVisible]; } splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; splashView.image = [UIImage imageNamed:@"splashscreen.png"]; [window addSubview:splashView]; [window bringSubviewToFront:splashView]; [self performSelector:@selector(removeSplash) withObject:nil afterDelay:3.0]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; NSLog(@"Registering for remote notifications"); [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; return YES; } 

Before the splash screen appears, the image "Arrow.png" appears, then my splash screen appears. If I delete "Arrow.png", other images will appear instead of that image, that is, "aboutus.png" as it continues.

I searched in my project for "Arrow.png", it appears only once in my entire project in encoding.

I ask you, Thank you very much, I am moving forward

+4
source share
3 answers

here you add subiview as a tab, as shown below.

 [window addSubview:tabBarController.view]; 

after adding loginview as below.

 [self.window addSubview:self.loginNav.view]; 

and after that you add a screensaver as shown below.

  splashView.image = [UIImage imageNamed:@"splashscreen.png"]; [window addSubview:splashView]; 

So, this is a problem that you saw more than a screen instead of a splashscreen.

use the following code ...

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; splashView.image = [UIImage imageNamed:@"splashscreen.png"]; [window addSubview:splashView]; [window bringSubviewToFront:splashView]; [self performSelector:@selector(removeSplash) withObject:nil afterDelay:3.0]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; NSLog(@"Registering for remote notifications"); [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; return YES; } 

and in the removeSplash method add this view as a removeSplash window as shown below.

 -(void)removeSplash{ [splashView removeFromSuperView]; LoginViewController *vc = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; self.loginNav = [[UINavigationController alloc] initWithRootViewController:vc]; NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; if([userDefaults valueForKey:@"UserName"] &&[userDefaults valueForKey:@"Password"]) { vc.username=[userDefaults valueForKey:@"UserName"]; vc.password=[userDefaults valueForKey:@"Password"]; vc.autoLogin=YES; [vc loginSelectorMethod]; } else { [self.window addSubview:self.loginNav.view]; [self.window makeKeyAndVisible]; } } 
+3
source

Hi, Babul installed any startup image in the ur project settings or you placed any image with the name "Default.png" in your project package, this kind of image is automatically detected by the OS when you run our application, please check this 2 points.

edit: -

hey babul, than the problem is the conflict in TabBar and LoginView and splaceImage.

for this, do below what i am doing, this fixes the double image problem.

first enter below code in your DidFinishLaunching method

// Delay secondly, how much time do you show with your shot splace
int64_t delayInSeconds = 5.0;

 dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ //Do need Full like Add Login View or Add TabbBar //Remove SplaceImageView From Window }); splashView = [[UIImageView alloc] initWithFrame:self.window.frame]; splashView.image = [UIImage imageNamed:@"Default-Portrait~ipad.png"]; [self.window addSubview:splashView]; [self.window bringSubviewToFront:splashView]; return YES; 

as well as adding another default image, for example

for iPhone Portrait Default.png. for iPad Portrait By default, portrait ~ ipad.png follow the apple document for the default image and check what. Thanks.

+2
source

may be useful to you ...

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; self.sql_ = [SQLDb initEngine]; [self setupControllers]; /// Set up Yor ToolBar Controller self.hvController = [[HomeViewController alloc] init]; self.window.rootViewController = self.hvController; [self.window makeKeyAndVisible]; [self setupSplash]; return YES; } -(void) setupSplash { self.imvSplash = [[UIImageView alloc] initWithFrame:self.window.bounds]; if( IS_IPHONE_5 ) [self.imvSplash setImage: [UIImage imageNamed:@" Default-568h@2x.png "]]; else [self.imvSplash setImage: [UIImage imageNamed:@"splash.png"]]; [self.window addSubview: self.imvSplash]; [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(hideSplash:) userInfo:nil repeats:NO]; } - (void)hideSplash:(NSTimer *)theTimer { [UIView animateWithDuration:1.0 delay:0.1 options: UIViewAnimationCurveEaseOut animations:^{ self.imvSplash.alpha = 0.0; self.ngNavigationController.view.alpha = 1.0; } completion:^(BOOL finished) { //[self.ngController setupImageAction]; [self.imvSplash removeFromSuperview]; }]; } 
+1
source

All Articles