ios - 如何使用 StoryBoard 将 UIButton 添加为 UIBarButtonItem?

标签 ios swift interface-builder uitoolbar

我在一个 swift 项目上使用工具栏,不知何故它有一个分段控件作为 BarButtonItem,它工作得很好。

enter image description here

enter image description here

我现在需要做的是在 FutureButton 下添加 2 个 UIButton,如果可能的话使用堆栈 View 。这似乎是可能的,因为它与另一个 BarbuttonItem 中的 segcontrol 几乎相同。

我尝试了针对类似问题建议的许多不同解决方案,但我无法添加任何内容,甚至无法添加另一个用于测试目的的 segcontrol,但没有任何运气。

知道如何实现这一目标吗?

编辑:添加应用截图

最佳答案

enter image description here试试这个方法 这是层次结构

-> UIToolBar 
      -> UIBarButton 
         -> UIView 
           -> UIStackView(vertical with 15 spacing)
             -> 2 UISegmentedControll (you can change as per you need)

关于ios - 如何使用 StoryBoard 将 UIButton 添加为 UIBarButtonItem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54578541/

相关文章:

ios - 应用程序在启动时崩溃 -- iTunes (ios)

ios - UITableView Header Override (UIView) 滚动行为异常

ios - 泛型类的扩展

swift - 在 SWIFT 中加密和解密

ios - 使用里拉数据,如何在 objective-c 中编写条件分支

ios - 错误原因 : unrecognized selector sent to instance after add library 'Google-Mobile-Ads-SDK' , '~> 7.8'

ios - 将 CoreData 实现到 TableView 时出现问题

iphone - 在 xcode 中修复/修复/重新生成损坏的 .xib 文件的方法?

iphone - Interface Builder 文件中的未知类

ios - 仅当添加第三个 segue 时才在 didSelectRowAtIndexPath 之前调用 prepareForSegue