Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

erdinc27

macrumors regular
Original poster
Jul 20, 2011
168
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];
    
}
 
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];
    
}

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.