1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #pragma mark 页面开始加载时调用 -(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { self.progressLine.hidden=NO;
__weak typeof(self) weakSelf = self; weakSelf.progressLineWidth.constant=0;
dispatch_async(dispatch_get_main_queue(), ^{ [UIView animateWithDuration:0.4 animations:^{ weakSelf.progressLineWidth.constant=WIDTH*0.5; [weakSelf.view layoutIfNeeded];
} completion:^(BOOL finished) { [UIView animateWithDuration:0.4 animations:^{ weakSelf.progressLineWidth.constant=WIDTH*0.8; [weakSelf.view layoutIfNeeded];
}]; }]; }); }
|