UIWebview after splash screen

Discussion in 'iOS Programming' started by erdinc27, May 2, 2012.

  1. erdinc27 macrumors regular

    Joined:
    Jul 20, 2011
    #1
    i want to show a UIWebView after splash screen disappear in the iPad app that i develop. it works but the problem is after splash screen disappear the RootViewController is seen after a couple of seconds the UIWebView is seen. here my codes. i dont know what can be wrong
    Code:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
        [self performSelectorOnMainThread:@selector(AdvertisementImage) withObject:self.window waitUntilDone:NO];
    }
    
    - (void) AdvertisementImage {
        
        introWeb=[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 768, 1004)];
        [introWeb loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://photos.modelmayhem.com/photos/100107/10/4b4625b0b3262.jpg"]]];
        introWeb.backgroundColor=[UIColor clearColor];
        introWeb.scalesPageToFit=YES;
        introWeb.delegate=self;
        
        for (id subview in introWeb.subviews)
            if ([[subview class] isSubclassOfClass: [UIScrollView class]]){
                ((UIScrollView *)subview).bounces = NO;
                [((UIScrollView *)subview) flashScrollIndicators];
            }
       
        introWeb.hidden=YES;
        
        [self.window addSubview:introWeb];
        
    }
    
    - (void) finishAdv{
    
       [introWeb removeFromSuperview];
       
    }
    
    - (void)webViewDidFinishLoad:(UIWebView *)webView {
        
        introWeb.hidden=NO;
        [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(finishAdv) userInfo:nil repeats: YES];
        
    }
    
     
  2. bravery1989 macrumors newbie

    Joined:
    May 4, 2013
  3. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #3
    So put the web view on the root view controller in your nib file. Hook it up with an outlet. In your didFinishLaunching:withOptions method, tell the web view to start loading your content.
     

Share This Page