Reputation: 132
I'm making simple iOS application where I have side menu (using swrevealviewcontroller) and tabbar with 3 tabs. I want when i click at specific menu item my tabbar change tab. But sidemenu does not have tabbar. I do following
UITabBarController *tabBarController = (UITabBarController *)[[[UIApplication sharedApplication] delegate] window].rootViewController;
[tabBarController setSelectedIndex: 1];
But app is getting crash with unrecognized selector sent to swrevealviewcontroller. What I'm doing wrong, or maybe you can show me another way to change selected tab by clicking menu row. Thanks
Upvotes: 1
Views: 307
Reputation: 757
Your side controller does'nt have tabbar controller because it is not part of that tab bar. So, you can make nsnotification that triggers method that change current tab ob tabbar.
Upvotes: 1