0

Can someone tell me definitively if there is a limitation with using Unwind Segues with UITableViewCell or if not how to achieve this?

I can successfully implement an unwind segue from my second view controller to my first - triggered using a simple UIButton.

However, when I try to use a UITableViewCell to create the unwind segue (drag from the TableViewCell to the green Exit icon then I do not get an option for Action Segue. Instead I get options for "Selection Segue" and "Accessory Action".

How can I trigger the unwind segue on selection of a UITableViewCell?

Hemang
  • 26,840
  • 19
  • 119
  • 186
Tomás
  • 535
  • 6
  • 23

2 Answers2

1

Selection segue will fire when you select the cell. Accessory action will fire when you tap the cell accessory. unwind: underneath the Selection Segue is the one you want to choose here:

enter image description here

jrturton
  • 118,105
  • 32
  • 252
  • 268
  • Thanks. I tried to use the "Selection segue" but it didn't do the unwind automatically (as happens if I use a UIButton instead of UITableViewCell). Would I need to create a segue from the second view controller to the first and then do a performSegueWithIdentifier within the IBAction? I need to pass some parameters back to the first view controller but I didn't want to be required to instantiate another FirstViewController to do this. I thought the Unwind segue would be a way around this but it doesn't seem to work. – Tomás May 04 '14 at 05:51
  • 1
    I've just created a basic test project and it works fine. You should be able to use unwinds, which part doesn't work? – jrturton May 04 '14 at 07:20
  • Whoops. I'll have to check this out and get back to you. Perhaps it is something else I am doing wrong... – Tomás May 04 '14 at 07:27
  • If the exit icon is inactive when you control-drag to it, try building the project - sometimes the storyboard doesn't detect the unwind action when you first add it. – jrturton May 04 '14 at 07:34
  • Ok, I'm such a dumbass that I didn't mention this in my original question (honestly just slipped my mind). I am using Xamarin.iOS. When I was running the project I was running it through Xamarin Studio. I would guess that it could be a bug in Xamarin. I have logged a support request with them and attached a sample project to reproduce the issue. @jrturton, thanks for the effort (redundant though it may be due to my neglecting to provide all relevant information!). I have updated my question to reflect the true context of the issue (i.e. Xamarin). I'll report back when I get a response. – Tomás May 04 '14 at 09:25
0

Ok. I'm a little embarrassed at my error here. I hadn't created an outlet for my UITableView and was instead using a tableview that I had created and added through code in my ViewController. Therefore the "Scene Exit" that I hooked up to the UITableViewCell on my storyboard was never being called (because the UITabelViewCell that it was hooked up to was not the one that was visible when the app ran)

I simply created an outlet to the table view and used that and all was fine. I'll put it down to my newbie status :-/

Tomás
  • 535
  • 6
  • 23