SuperFrog
SuperFrog

Reputation: 7674

Change UITabBar BarTintColor when TabBarItem is selected

I'm trying to change BarTintColor of UITabBar when the user switches between tabs. I've tried using ItemSelected:

public override void ItemSelected(UITabBar tabbar, UITabBarItem item)
{
        base.ItemSelected(tabbar, item);
        UITabBar.Appearance.BarTintColor = UIColor.Yellow;
}

This doesn't work and an exception is thrown (that's the short version...):

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[MainTabs tabBar:didSelectItem:]: unrecognized selector sent to instance 0x7d143e00

How can I change the color of BarTintColor when the user switches between tabs?

Upvotes: 0

Views: 261

Answers (1)

wolfprogrammer
wolfprogrammer

Reputation: 634

base.ItemSelected(tabbar, item); is causing the exception to be thrown. Simply remove the base call from the method and it should work for you.

Upvotes: 1

Related Questions