WebBrowseViewController.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // WebBrowseViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 5/13/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "WebBrowseViewController.h"
  9. @interface WebBrowseViewController () <UIWebViewDelegate> {
  10. }
  11. @end
  12. #pragma mark - Class Definition
  13. @implementation WebBrowseViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. [self initUI];
  18. [self prepareViewDidLoad];
  19. }
  20. - (void)initUI {
  21. self.title = self.titleString;
  22. _webView.delegate = self;
  23. }
  24. - (void)prepareViewDidLoad {
  25. if (_URLString && ![_URLString isEmptyString]) {
  26. NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:_URLString]];
  27. [_webView loadRequest:request];
  28. }
  29. }
  30. #pragma mark - UIWebView Delegate
  31. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
  32. if(navigationType == UIWebViewNavigationTypeLinkClicked) {
  33. [[UIApplication sharedApplication] openURL:request.URL];
  34. return NO;
  35. }
  36. return YES;
  37. }
  38. #pragma mark - UI Events
  39. - (void)btnBackTouched:(id)sender {
  40. [self.navigationController popViewControllerAnimated:YES];
  41. }
  42. #pragma mark - MemoryWarning
  43. - (void)didReceiveMemoryWarning
  44. {
  45. [super didReceiveMemoryWarning];
  46. // Dispose of any resources that can be recreated.
  47. }
  48. @end