Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:18:48+00:00 2026-06-05T19:18:48+00:00

Our goal is simple for an iPhone app: show a splash page then hide

  • 0

Our goal is simple for an iPhone app: show a splash page then hide it when a UIWebview is ready to show its page.

We need the default splash screen to linger until the UIWebview is ready to display. Otherwise, a white screen appears briefly.

Unfortunately, the splash screen fails to hide after we make it linger. The default splash screen remains visible, concealing the UIWebview underneath.

We understand this may violate Apple guidelines.

This is more for a prototype than anything, and we would like to understand what we’re doing wrong. Any clues?

We’re using Xcode 4.2.

AppDelegate.m:

//
//  AppDelegate.m
//
//  Created by Macintosh User on 6/4/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "AppDelegate.h"

#import "ViewController.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize imgv;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    imgv = [[UIImageView alloc] init];
    [imgv setImage:[UIImage imageNamed:@"Default.png"]];
    [imgv setFrame:CGRectMake(0, 0, 320, 480)];
    [self.window addSubview:imgv];

    return YES;
}

@end

ViewController.m:

//
//  ViewController.m
// 
//
//  Created by Macintosh User on 6/4/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"

@implementation ViewController

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
    UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
    [webView setBackgroundColor:[UIColor clearColor]];
    NSString *urlAddress = @"http://www.cnn.com";
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];

    for (id subview in webView.subviews)
        if ([[subview class] isSubclassOfClass: [UIScrollView class]])
            ((UIScrollView *)subview).bounces = NO;

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    UIImageView *imageView = appDelegate.imgv;
    [imageView removeFromSuperview];
    [imageView setHidden:YES];
    imageView = nil;

    [self.view addSubview:webView];
    [self.view bringSubviewToFront:webView];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSLog(@"Done loading UIWebView");
}

@end

Curret ViewController.m generating errors:

//
//  ViewController.m
//  Stroll
//
//  Created by Macintosh User on 6/4/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"

@implementation ViewController

@synthesize splash;

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
    UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];

    webView.delegate = self;

    [webView setBackgroundColor:[UIColor clearColor]];
    NSString *urlAddress = @"http://www.cnn.com";
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];

    for (id subview in webView.subviews)
        if ([[subview class] isSubclassOfClass: [UIScrollView class]])
            ((UIScrollView *)subview).bounces = NO;

    /*
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    UIImageView *imageView = appDelegate.imgv;
    [imageView removeFromSuperview];
    [imageView setHidden:YES];
    imageView = nil; */

    [self.view addSubview:webView];
    [self.view bringSubviewToFront:webView];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSLog(@"Done loading UIWebView");
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{

        self.view.userInteractionEnabled = NO;

        splash = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];

        splash.image = [UIImage imageNamed:@"Default.png"];
        [self.view addSubview:splash];
    });
}

-(void) webViewDidFinishLoad:(UIWebView *)webView {

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [splash removeFromSuperView];
    });
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:18:50+00:00Added an answer on June 5, 2026 at 7:18 pm

    Here’s a way to achieve it, get rid of all the code in your AppDelegate first of all. In your root view controller add an instance variable of class UIImageView called “splash”.

    Now in the rootViewController.m:

    -(void) viewWillAppear:(BOOL) animated {
    
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
    
            self.view.userInteractionEnabled = NO;
    
            splash = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
            splash.image = [UIImage imageNamed:@"Default.png"];
            [self.view addSubview:splash];
        });
        }
    

    Now in your webView load completion callback method/block

    static dispatch_once_t onceToken;
            dispatch_once(&onceToken, ^{
    
              [splash removeFromSuperView];
            });
    

    so the dispatch_once makes sure the method will run once and only once in the life time of the application.

    EDIT:

    To get your callback:

    in viewController.h -> viewC : UIViewController < UIWebViewDelegate >

    in viewController.m

    -(void) viewDidLoad{
    
        CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
        UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
    
        webView.delegate = self;
    
        [webView setBackgroundColor:[UIColor clearColor]];
        NSString *urlAddress = @"http://www.cnn.com";
        NSURL *url = [NSURL URLWithString:urlAddress];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [webView loadRequest:requestObj];
    }
    

    then

    -(void) webViewDidFinishLoad:(UIWebView *)webView {
    
        static dispatch_once_t onceToken;
            dispatch_once(&onceToken, ^{
    
              [splash removeFromSuperView];
            });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an existing web app built with jQuery Mobile. Our goal is to
Goal : Our application is built using multiple types (e.g. Person, PersonSite(ICollection), Site -
Our app uses a component that requires a license file in the directory with
Our database is part of a (specialized) desktop application. The primary goal is to
Here is our goal: We want to select each month and the revenue gained
Our application takes text from a web form and sends it via email to
Our organization's software is compiled for the .NET 3.5 Framework. We have some customers
Our team is now beginning to look at jumping from 2.0 to 3.5 and
Our current product is based on Eclipse RCP. We are starting to have problems
Our environment: Drupal+MySQL Examining the query log indicates that the following query, originating from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.