Search code examples
iosswiftxcodesegue

tableViewCell segue does not work. because of trigger?


I needed to add, into a working swift project, a tableViewCell, and a segue from it. I did, but it did not call the prepare function. so I compared the existing segues in the storyboard xml with my new segue, and I did find a difference, my segue has trigger property.

I guess I now need to remove this segue and add a new one.

so, How do I create a segue without trigger="accessoryAction" property?

existing:

  <connections>
    <segue destination="x1H..." kind="show" identifier="segueToSettingA" id="e4m..."/>
  </connections>

my new non working:

  <connections>
    <segue destination="Zg7..." kind="show" identifier="segueToSettingB" trigger="accessoryAction" id="7eW..."/>
  </connections>

Solution

  • It is because the "accessoryAction" trigger. According with this, there is a bug with accessorybuttontappedforrowwith and UITableViewCell segue.

    You can try changing to trigger="selection" or removing the trigger, but the best solution is to use the visual interface and mark the option:

    enter image description here