Hello, I am seeking information for the use of Switch button. Actually I search a way to do the following: When the Switch button is OFF it should stay on the current page. by cons when it’s on it I wish it displays a specific web page while remaining within the application. If someone has information that would be great. thank you
Well the UISwitch is called by something like this:
@IBOutlet weak var aSwitch: UISwitch!
@IBOutlet weak var aLabel: UILabel!
@IBAction func actionTriggered(sender: AnyObject) {
let onState = aSwitch.on
if onState {
aLabel.text = "Switch is on"
} else {
aLabel.text = "Off"
}
}
and you can use this to open the web page:
UIApplication.sharedApplication().openURL(NSURL(string: "http://www.google.com")!)
Thank you very much I will try