刷簡書閱讀量
//
// ViewController.m
// 是是是
//
// Created by majianjie on 2017/4/12.
// Copyright © 2017年 majianjie. All rights reserved.
//
#import "ViewController.h"
#import <UIKit/UIKit.h>
@interfaceViewController()<UIWebViewDelegate>
@property (strong, nonatomic)UIWebView *webView;
@property(nonatomic, assign
@property(nonatomic, assign)NSUInteger curTimeNum;
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
self.webView = [[UIWebViewalloc] init];
self.webView.frame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height - 20);
[self.viewaddSubview:self.webView];
self.timesNum = 200;
[selfloadPage];
self.webView.delegate = self;
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[selfloadPage];
});
}
-(void)loadPage{
if (self.curTimeNum<self.timesNum) {
NSURLRequest *request = [NSURLRequestrequestWithURL:[NSURLURLWithString:@"http://www.jianshu.com/p/651c83c74061"]];
[self.webViewloadRequest:request];
self.curTimeNum++;
}
}
@end