简体   繁体   中英

SwRevealViewController tabbar change tab

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM