I work with Xamarin.iOS I would like to use PrepareForSegue
to transport data from variables from two ViewControllers
to one, how should I do it?
I have already tried to change the value of the var variable that I use to transport data, change to another ViewController
. It doesn't work, I don't know what to do, please help.
When I want to create a second PrepareForSegue
method, I get an error no method found to be overridden.
Not understanding
from two ViewControllers to one
I will show how to transfer data from ControllerA to ControllerB.
ControllerA :
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue(segue, sender);
var controllerB = segue.DestinationViewController as ControllerB ;
controllerB.passValue = "ControllerA's data";//set data from ControllerA
controllerB.retSegue = segue;
}
ControllerB:
public string passValue;
public override void ViewDidLoad()
{
base.ViewDidLoad();
//labeltwo is a Label Control in ControllerB
labeltwo.Text = passValue ; // here can get data from ControllerA
}
If your want is navigating from ControllerA to ControllerB ,and last to ControllerC, also can use up way to transfer data .