How to use a single segue (1 segue for 5 buttons) instead of 5 segues (1 per button) leaving only one, which contains all the IBAaction and takes you to the other view depending on what you press, the content in the other view is presented in one way or another.
I have been trying the following code but without result.
Origin
@IBAction func abstractionENG(sender: UIButton) { return performSegueWithIdentifier("menuENG", sender: nil) }
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "menuENG")
{ if let destinationViewController = segue.destinationViewController as? DefinitionViewController{
destinationViewController.tittle = DiccioModel.abstraction().nameEng destinationViewController.def = DiccioModel.abstraction().descriptionEng destinationViewController.link = DiccioModel.abstraction().linkEng } }
Destination
import UIKit
class DefinitionViewController : UIViewController {
@IBOutlet weak var name:UILabel!
@IBOutlet weak var bodyText:UITextView!
var tittle:String!
var def:String!
var link:String!
/*This IBAction activates hyperlink to Wikipendia */
@IBAction func linkToWiki(sender: UIButton) {
if let url = NSURL(string: link) { UIApplication.sharedApplication().openURL(url) }
}
var definition : DiccioModel!
override func viewDidLoad() {
super.viewDidLoad()
self.definition = DiccioModel.webBrowser()
self.name.text = tittle
self.bodyText.text = def
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// End of the code...
}
//
Does anyone have any way to do it as I request it or could it guide me? I have been trying in various ways in code without result
PS: I have identified each button in the IDentity inspector with numbers to implement them in the sender but I do not achieve the result either. PS: I'm Rookie level in this so if they could be clarifying it would be great :) Greetings