Thank you, Nick!
I tried using the UITabBarSelectionEventArgs argument from the
ViewControllerSelected event with no success. Tried different varitions of
args.ViewController.NavigationController, args.ViewController.NavigationItem,
args.ViewController.TabBarController.NavigationController and so forth. Alas,
no success. In most of these cases I was greeted with a NullReferenceException.
Planned to send another mail to this forum with followup questions when I tried
the simplest approach there is;
if (args.ViewController.TabBarController.TabBarItem.Title == "Alarm")
{
_navigationRoots[0].PopToRootViewController(false);
}
(defined prior to the above clause:
_tabBarController.SetViewControllers(_navigationRoots, false); )
Oh joy, it works! Thanks for your input :-)
Kind regards,
Ronny Dahl
Keywork AS
http://www.keywork.no/
-----Original Message-----
From: Nic Wise [mailto:[email protected]]
Sent: Tuesday, January 22, 2013 11:47 AM
To: Ronny Dahl
Cc: [email protected]
Subject: Re: [MonoTouch] ViewControllerSelected, change to root viewcontroller
Have a look at the NavigationController for that tab (or the NavigationItem, I
don't remember at the moment, but you can get one from the other)
There is a method on there called something like "PopToRootViewController",
which will throw you right back to the top of the stack.
If you can't find it, yell out and I'll dig some code out.
On 22 January 2013 07:38, Ronny Dahl <[email protected]> wrote:
> I use a TabBarController to host five NavigationControllers. Let’s say
> the user navigates, on the first NavigationController
> (ProductListViewController), to a ViewController that is one level in
> (let’s call it DetailViewController for simplicity). When the same
> user switch to another tab and then comes back to the first tab,
> he/she is still presented with the DetailViewController. I do
> understand that that’s the preferred way to do things in most cases,
> but my employer insists on sending the user back to the
> ProductListViewController instead. I know the user will be sent back
> to the root of the NavigationViewController if he/she clicks the same tab
> twice, but that’s not good enough.
>
>
>
> I have discovered that the ViewControllerSelected event fires whenever
> the tab is changed, but I have yet to discover how to solve the above problem.
> Any pointers?
>
>
>
>
>
> Kind regards,
>
> Ronny Dahl
>
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
--
Nic Wise
t. +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch