[Tips] Use UIRefreshControl on UIWebview

UIRefreshControl can use on UIWebView. It’s just so easy.
/****  code sample ***/
    UIRefreshControl refreshControl = [[UIRefreshControlalloc] init];
    [refreshControl addTarget:selfaction:@selector(refresh)forControlEvents:UIControlEventValueChanged];
    NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
    [attributes setObject:[UIColorwhiteColor] forKey:NSBackgroundColorAttributeName]; //background color :optional
    [attributes setObject:[UIColorgrayColor] forKey:NSForegroundColorAttributeName];  //title text color :optionala
    NSAttributedString *title = [[NSAttributedString alloc] initWithString:@”Refresh!!” attributes:attributes];
    refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:selfaction:@selector(refresh)forControlEvents:UIControlEventValueChanged];
    refreshControl.attributedTitle = title;
    [refreshControlsetTintColor:[UIColorblueColor]];

    [self.WebView.scrollViewaddSubview:refreshControl]; //

/****  code sample ***/

 

We hope this article help you :)