简体   繁体   English

没有选项卡的iOS选项卡栏项目

[英]iOS tab bar item with no controller associated

I have my own subclass of UITabBarController. 我有自己的UITabBarController子类。 I am trying now to add a simple button (UITabBarItem) in the storyboard. 我现在尝试在情节提要中添加一个简单的按钮(UITabBarItem)。 The thing is that I don't want to associate a controller with it. 问题是我不想将控制器与其关联。 An action on that item will simply fire a prompting alert to confirm switching between two modes. 对该项目执行操作只会触发提示警报,以确认两种模式之间的切换。

So, what is the clean way to add an element in tab bar from StoryBoard without linking to anything (and doing stuff programatically) ? 那么,从StoryBoard的选项卡栏中添加元素而不链接到任何东西(以编程方式进行操作)的干净方法是什么?

is this what you're looking for? 这是您要找的东西吗? Via delegation you can define the items' behaviour set up an action with a tab bar item - iphone 通过委派,您可以定义项目的行为并使用标签栏项目设置操作-iPhone

edit: i don't know about storyboard only. 编辑:我不只知道故事板。 but doing it that way wouldn't really be hard. 但是那样做并不难。 Define your custom TabBarController, use the delegate method and implement your logic. 定义您的自定义TabBarController,使用委托方法并实现您的逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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