ios - SwRevealViewController 标签栏更改标签

标签 ios objective-c swrevealviewcontroller

我正在制作简单的 iOS 应用程序,其中有侧边菜单(使用 swrevealviewcontroller)和带有 3 个选项卡的选项卡栏。当我点击特定菜单项时,我想要我的标签栏更改标签。但是sidemenu没有tabbar。 我做以下

UITabBarController *tabBarController = (UITabBarController *)[[[UIApplication sharedApplication] delegate] window].rootViewController; 
[tabBarController setSelectedIndex: 1];

但是应用程序因发送到 swrevealviewcontroller 的无法识别的选择器而崩溃。我做错了什么,或者您可以通过单击菜单行向我展示另一种更改所选选项卡的方法。谢谢

最佳答案

您的侧 Controller 没有标签栏 Controller ,因为它不是该标签栏的一部分。因此,您可以制作 nsnotification 来触发更改当前选项卡或选项卡栏的方法。

关于ios - SwRevealViewController 标签栏更改标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33059375/

相关文章:

ios - iOS推送通知证书的脚本创建

ios - 调用函数后如何导航到不同的内容页面

ios - NSInvalidArgumentException',原因 : '-[UILabel view]: unrecognized selector sent to instance 0x7ffbd0da2680'

ios - SWReveal 问题与由 UIAlert 按钮选择启动的导航

ios - 为什么 rightRevealToggle 在 'SWRevealViewController' 中什么都不做?

ios - 登录 View 后的 SWRevealViewController

ios - 更新到 Parse 1.8.4 pod 后出现 Apple Mach-O Linker 错误

ios - 自定义重叠 UITableViewCells

iphone - 如何防止 NSMutableDictionary 在 initWithContentsOfFile 时将我的长 NSString 转换为 NSNumber?

objective-c - 在界面生成器中将列添加到 nstableview