PrepareForSegue for TableView inside UIViewController

Hello,
I have a UITableView inside a UIViewController. When I click a row in the UITableView I want the user to redirect to another page. I have created a segue and gave it the name „getDetails“. I have this code:
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { Console.WriteLine ("preparing for segue right now!"); if (segue.Identifier == "getDetails") { var indexPath = TableViewEG.IndexPathForSelectedRow; //TableViewEG is the TableView where I have the data records Ausgabe item = dataSourceAusgaben.Objects [indexPath.Row]; ((ControllerEinGaben)segue.DestinationViewController).SetDetailItem (item); //should get redirected to the new Controller with passing some informations } }

My problem is, that the PrepareForSegue() Method is called everytime when I click a button outside the UITableView but not when I click row inside my TableViewEG.

How can I fix this?

Greets from Austria,
Fabian

Posts

Sign In or Register to comment.