I can make a app with a table view, but i need cells to redirect me to a youtube video. I want to make when i press one cell this show me a youtube video or send me to another view controller. Please help me
class ViewController: UITableViewController {
var tricks = [Trick]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.tricks = [Trick(name: "Ollie" ), Trick(name: "Kickflip"), Trick(name: "Heelflip"), Trick(name: "Varial Kickflip"), Trick(name: "Varial Heelflip"), Trick(name: "TreeFlip")]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) ->Int {
return self.tricks.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)as! UITableViewCell
var trick : Trick
trick = tricks[indexPath.row]
cell.textLabel?.text = trick.name
return cell
}
}