I am developing an iOS
app using Xamarin.IOS
C#
I don't use segue for some reason.I have 3 UIViewContoller
. First UIViewController
push second UIViewController
and after second contoller opens the third UIViewController
. And when I select a row, I am going back to first controller. But at this time, in third controller I would like to change a variable of the first UIViewController
.
logically it works like that
Controller ---> 2. controller --> 3. controller->
select a row and ACCESS the first controller's variable andassign it --> 2. controller --> 1. controller
and see this variable is change or not so this variable is null, not be changed
here is my code
THIS IS IN FIRST CONTROLLER
public int myVariable = 0;
-----
var controller2 =(SecondController)this.Storyboard.InstantiateViewController("SecondControllerStoryboard");
var mynextController = new SecondController(controller2.Handle);
NavigationController.PushViewController(mynextController, true);
THIS IS IN SECOND CONTROLLER
public int myVariable2=0;
// here i used segue
// it goes back to previous (first contoller)
NavigationController.PopViewControllerAnimated(true);
THIS IS IN THIRD CONTROLLER
var controller = (DocumentUpload)this.Storyboard.InstantiateViewController("FirstControllerStoryboard");
controller.myVariable= selectedIndex;
// It goes back the previous (second) controller
NavigationController.PopViewControllerAnimated(true);
so when first's controller viewdidapper, myVariable is still null
So probably, in third controller, it creates a new instance then i cant change the variable.
I am looking for like that desktop application
if (Application.OpenForms[i].Name)
...