SPWebViewController.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // SPWebViewController.m
  3. // SDLPal
  4. //
  5. // Created by palxex on 2017/6/13.
  6. // Copyright © 2017年 SDLPAL team. All rights reserved.
  7. //
  8. #import "SPWebViewController.h"
  9. #define UIKitLocalizedString(key) [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] localizedStringForKey:key value:@"" table:nil]
  10. @interface SPWebViewController ()<UIWebViewDelegate>
  11. @property (strong, nonatomic) IBOutlet UIWebView *webView;
  12. @end
  13. @implementation SPWebViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
  18. [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
  19. }
  20. - (void)didReceiveMemoryWarning {
  21. [super didReceiveMemoryWarning];
  22. // Dispose of any resources that can be recreated.
  23. }
  24. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
  25. if( [request.URL.path containsString:self.signature] ) {
  26. [self.navigationController popViewControllerAnimated:YES];
  27. [self.delegate capturedURL:request.URL];
  28. return NO;
  29. }
  30. return YES;
  31. }
  32. - (void)webViewDidFinishLoad:(UIWebView *)webView {
  33. [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  34. [self setTitle:[self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]];
  35. }
  36. /*
  37. #pragma mark - Navigation
  38. // In a storyboard-based application, you will often want to do a little preparation before navigation
  39. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  40. // Get the new view controller using [segue destinationViewController].
  41. // Pass the selected object to the new view controller.
  42. }
  43. */
  44. @end