// // ViewController.swift // Interactive Google Charts // // Created by pgAgent on 11/02/2015. // Copyright (c) 2015 RJM Programming. All rights reserved. // import UIKit class ViewController: UIViewController { var myWebView:UIWebView = UIWebView(frame: CGRectMake(0, (270 + 40) * 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height - (200 - 40 - 110) * 0 - 50)) var btnb:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 20)) var btnf:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 20)) //method for going backwards in the webpage history func backMethod(sender: UIButton!) { myWebView.goBack() } //method for going forward in the webpage history func forwardMethod(sender: UIButton!) { myWebView.goForward() } override func viewDidLoad() { super.viewDidLoad() btnb.setTitle("Back", forState: UIControlState.Normal) btnb.backgroundColor = UIColor.greenColor() btnb.addTarget(self, action: "backMethod:", forControlEvents: UIControlEvents.TouchUpInside) btnb.center = CGPointMake(100, UIScreen.mainScreen().bounds.height - 35) btnb.hidden = false self.view.addSubview(btnb) btnf.setTitle("Forward", forState: UIControlState.Normal) btnf.backgroundColor = UIColor.greenColor() btnf.addTarget(self, action: "forwardMethod:", forControlEvents: UIControlEvents.TouchUpInside) btnf.center = CGPointMake(220, UIScreen.mainScreen().bounds.height - 35) btnf.hidden = false self.view.addSubview(btnf) myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php?WebView=justmenuWebView")!)) self.view.addSubview(myWebView) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }