Wednesday, June 5, 2013

UIScrollView flashScrollIndicators example in Objective C (iOS).


UIScrollView flashScrollIndicators

Displays the scroll indicators momentarily.

- (void)flashScrollIndicators

Discussion of [UIScrollView flashScrollIndicators]
You should call this method whenever you bring the scroll view to front.

UIScrollView flashScrollIndicators example.
[myScrollView flashScrollIndicators];

Example of [UIScrollView flashScrollIndicators].
- (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];
   
}

UIScrollView flashScrollIndicators example.
-(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event {
[scrollView flashScrollIndicators];
}

End of UIScrollView flashScrollIndicators example article.