Search code examples
iosobjective-cuiviewuiimageviewsplash-screen

How to create a second splash screen (after default splash screen in ios)?


I tried to add a second splash screen to iOS existing project, this project was too old and using xib's.

So i was planning to show default splash screen first and then my own one image as splash screen after that login page.

This is what i have done so far

In my ViewController.m file i have created on UIView and added one UIImageView its working but the problem is i can see navigationbar also along with second splash screen .

I dont want that navigation bar.

Please help me Code

ViewController.m   in ViewDidload ()



 self.navigationController.navigationBar.hidden=YES;

    _splash.frame=CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);
    _splashImg.frame=_splash.frame;
    [self.view insertSubview:_splash aboveSubview:_loginView];
    [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(runMethod) userInfo:nil repeats:NO];
    [self.view addSubview:_splashView];
    [self.view bringSubviewToFront:_splashView];
    UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"rss2.png"]];
    img.frame=_splashView.frame;
    [_splashView addSubview:img];

Solution

  • try this

    To hide the navigation bar:

    [[self navigationController] setNavigationBarHidden:YES animated:YES];
    

    To show it:

    [[self navigationController] setNavigationBarHidden:NO animated:YES];
    

    else

    -(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES];   //it hides  
    

    }

    -(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO];    // it shows
     }