1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // SPWebViewController.m
- // SDLPal
- //
- // Created by palxex on 2017/6/13.
- // Copyright © 2017年 SDLPAL team. All rights reserved.
- //
- #import "SPWebViewController.h"
- #define UIKitLocalizedString(key) [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] localizedStringForKey:key value:@"" table:nil]
- @interface SPWebViewController ()<UIWebViewDelegate> {
- BOOL finished;
- }
- @property (strong, nonatomic) IBOutlet UIWebView *webView;
- @end
- @implementation SPWebViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
- if( [request.URL.path hasSuffix:self.signature] ) {
- [self.navigationController popViewControllerAnimated:YES];
- [self.delegate capturedURL:request.URL];
- return NO;
- }
- return !finished;
- }
- - (void)webViewDidFinishLoad:(UIWebView *)webView {
- finished = YES;
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
- [self setTitle:[self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]];
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|