Skip to content

Instantly share code, notes, and snippets.

@jaybuangan
Created April 11, 2016 23:18
Show Gist options
  • Save jaybuangan/1a8c020ac2b2b213928bc2afa865be22 to your computer and use it in GitHub Desktop.
Save jaybuangan/1a8c020ac2b2b213928bc2afa865be22 to your computer and use it in GitHub Desktop.
import UIKit
import Firebase
import DZNWebViewController
class HomeViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
let firebaseRef = Firebase(url:"")
weak var webModalNC: UINavigationController?
override func viewDidLoad() {
super.viewDidLoad()
...
}
override func viewWillAppear(animated: Bool) {
self.tabBarController?.tabBar.hidden = false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
extension HomeViewController: ShowSourceModalDelegate {
func showSource(url: String) {
let vc = DZNWebViewController(URL: NSURL(string: url)!)
self.webModalNC = UINavigationController(rootViewController: vc)
vc.supportedWebNavigationTools = DZNWebNavigationTools.All
vc.supportedWebActions = DZNsupportedWebActions.DZNWebActionAll
vc.showLoadingProgress = true
vc.hideBarsWithGestures = true
vc.showPageTitleAndURL = true
let closeButton = UIBarButtonItem(title: "Close", style: .Plain, target: self, action: #selector(HomeViewController.closeWebModal))
vc.navigationItem.rightBarButtonItem = closeButton
if let webModal = self.webModalNC {
print(webModal)
self.presentViewController(webModal, animated: true, completion: nil)
}
}
func closeWebModal(){
self.webModalNC!.dismissViewControllerAnimated(true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment