thieumao

Back WebView

Apr 25th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.51 KB | None | 0 0
  1. override func viewDidLoad {
  2.         super.viewDidLoad()
  3.         self.navigationItem.hidesBackButton = true
  4.         let newBackButton = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.Bordered, target: self, action: "back:")
  5.         self.navigationItem.leftBarButtonItem = newBackButton;
  6.     }
  7.  
  8.     func back(sender: UIBarButtonItem) {
  9.         if(webview.canGoBack) {
  10.              webview.goBack()
  11.         } else {
  12.              self.navigationController.popViewController(animated:true)
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment