I have table source class and on row click I am calling below function to move to another controller but I want to pass some data.
controller.PerformSegue("backtorootviewsague",controller);
Does any knows how can I achieve it. I am new in monotouch and ios. I cannot figure out how to achieve this.
Pass Data using Seque. After outlet is connected to respective viewController, select Enter Last Name button and then CTRL + Drag to NextViewController(i.e, FirstViewController) for showing the viewController from LandingPageViewController. This lets you set what kind of segue you want to use.
performSegue(withIdentifier:sender:)Initiates the segue with the specified identifier from the current view controller's storyboard file.
PrepareForSegue
is the right place to do it. For example, if the controller that creates
CustomerViewController
is called CustomerListViewController
, override in CustomerListViewController
that method like the following:
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue (segue, sender);
// do first a control on the Identifier for your segue
if (segue.Identifier.Equals("your_identifier")) {
var viewController = (CustomerViewController)segue.DestinationViewController;
viewController.MyData = dataToInject;
}
}
where CustomerViewController
has a public property like the following:
public SomeTypeData MyData { get; set; }
You could see this in action in Xamarin samples.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With