Reputation: 294
I using a tableView inside a viewController. I am trying to send data to a detailViewController. But for some reason i can't push to the detail view. I am not getting any errors. Its just not working.
Here is my code for the segue:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject) {
if (segue.identifier == "test") {
let detailViewController: DetailViewController = segue.destinationViewController as DetailViewController
//println(index)
detailViewController.fromPreviousView = index
//
}
Upvotes: 3
Views: 1677
Reputation: 2207
Check the source code for storyboard by right clicking MyStoryBoard->Open As->Source Code.
Search for :
trigger="accessoryAction"
If you find it , delete it.
Sometime ctrl+dragging adds this additional attribute causing issues with prepareForSegue.
Upvotes: 0
Reputation: 591
It seems that is a bug from the last beta (4 maybe till the beta 3) release of Xcode 6. I'm facing the same problem till I have upgraded to this new version. The "prepareForSegue" method is never called. The same code worked with the previous (beta 2) release but I didn't see anything about that in the "Known issues in Xcode 6 beta 4!" section in the release notes but there is a list of IB issues.
Upvotes: 0
Reputation: 10432
You registering tableView cell programatically , So it will create different cell not the one in the storyboard so there is no segue.
Solution is delete this line of code self.tableViewOutlet.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
and give cell identifier to the cell in story board to "cell". It will work.
Upvotes: 3