Override tabbarviewcontroller selection

BalinaBlintBalinaBlint USMember ✭✭

Hi!

I have the following issue:
I have some tabs on my tab bar. There is one, which should only be presented to the user, if he is logged in. I tried to accomplish something like if he selects the critical tab I show an error popup, that he needs to log in, and stay on the tab which is currently selected.

I tried the following code:


public override void ItemSelected (UITabBar tabbar, UITabBarItem item)
{
var index = Array.IndexOf (tabbar.Items, item);
if (...canseetab...) {
SelectedViewController = ViewControllers [index];
SelectedIndex = index;
}
}

The solution above is not working. The content stays on the current tab (which is good), but the controller has the critical item selected anyway.
So if he can not see the tab, than I would like to cancel the selection, but found no proper event, or method to override.

Thank you for your help, in advance!

Sign In or Register to comment.