views:

572

answers:

2

Hi,

I'd like to deselect(or unhighlight) selected tab item. I tried many things I can, but no luck.

My tab bar is wrapped by UITabBarController (say it as tvc).

First, I tried

tvc.selectedIndex = -1 or 0 or nil;

then nothing happened.

Second

tvc.tabBar.selectedItem = -1 or 0 or nil;

it crashed.

Is there any other way I can do? Thanks in advance.

One more thing, without UITabBarController (only with UITabBar), by setting its selectedItem as nil, it deselect(unhighlight) selected item. but with controller, no, failed.

A: 

You could try setting selectedViewController on the UITabBarController to nil. Not sure if it'll do what you need but under OS 3.0 the way tab controllers are managed have changed.

Ramin
A: 

I tried it, but it crashed with this stack trace below. developing in OS 3.0 env.

#0  0x302ac924 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___
#1  0x966d6e3b in objc_exception_throw
#2  0x3028e5fb in +[NSException raise:format:arguments:]
#3  0x3028e55a in +[NSException raise:format:]
#4  0x30ab8226 in -[UITabBar setSelectedItem:]

Thanks anyway.

eskim2rock