SWRevealViewController nib cell does not execute segue

Simply put, I have a slide navigation view controller in my application with a back VC table and a front VC table. The selected cell in the back VC table should go to the front VC table (built into the VC navigation system). To illustrate, here are isolated pre-settings and a code that works correctly:

enter image description here enter image description here enter image description here

Here is the simplified working code in my reverse table. VC cellForRowAtIndexPath :

  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let navigationCell = tableView.dequeueReusableCellWithIdentifier("NavigationCell", forIndexPath: indexPath) as UITableViewCell return navigationCell } 

Okay, for the fun part. All I want is to replace the default UITableViewCell shown above with one of my custom cells in the Xib file. Now I will illustrate what I have changed. First, here is my Xib cell in my NavigationCell.xib file. Nothing special.

enter image description here enter image description here

My NavigationCell class is just

 import UIKit class NavigationCell: UITableViewCell { @IBOutlet var nameLabel: UILabel! } 

Finally, I changed my code in my back VC table to register Xib and remove the extra cell:

 override func viewDidLoad() { super.viewDidLoad() let navigationCellNib = UINib(nibName: "NavigationCell", bundle: nil) tableView.registerNib(navigationCellNib, forCellReuseIdentifier: "NavigationCell") } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let navigationCell = tableView.dequeueReusableCellWithIdentifier("NavigationCell", forIndexPath: indexPath) as! NavigationCell return navigationCell } 

All other codes and specifications remain unchanged. The storyboard script for the new custom cell is still in the SWRevealViewControllerSeguePushController class, as shown in the first screenshot for this question. I just swapped the default UITableViewCell with my custom Xib cell.

This modification was sufficient to stop the appearance of the segment. With this modification, after I create and launch, when I turn the VC navigation menu back and select one of my custom navigation cells (which display correctly), it does not cause any changes. Any thoughts?

+6
source share
1 answer

I am an idiot. I have to programmatically execute segue in the didSelectRowAtIndexPath file.

 override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { self.performSegueWithIdentifier("MySegue", sender: self) } 
+4
source

All Articles