swift - 所需页面的通用 UIToolbar - Xcode 8.3

标签 swift xcode uibarbuttonitem uitoolbar

请建议我们如何为所需页面创建通用的UIToolbar(带有栏项目)?

我知道我们可以在每个 View Controller 中添加自定义 UIBarButtonItem。

最佳答案

假设您使用 Storyboard。首先,将 UIToolBar 项目拖到 Storyboard 中。

enter image description here 接下来,设置工具栏的位置。在我的示例中,我将其放在底部,向左、右和底部填充 0。高度设置为44

enter image description here

最后,将任意数量的栏按钮项目拖动到工具栏,然后在它们之间添加空格。您可以使用固定长度的空格,也可以通过简单地将它们拖动到栏按钮项目之间来使用灵活的空格(在本示例中使用)。

enter image description here

关于swift - 所需页面的通用 UIToolbar - Xcode 8.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44675168/

相关文章:

ios - 自动布局 : animating height to zero while preserving user interaction

swift - 为什么 Swift 参数标签对 BLE 回调很重要

iphone - UIToolbar UIBarButtonItem 对齐问题

ios - UIBarButtonItem 按下时什么都不做

iOS 应用程序在恢复购买后提示用户使用密码 "Confirm Your In-App Purchase"

ios - 使用 CocoaPods 模块化大型 iOS 应用程序

Xcode6创建新项目时如何设置类前缀?

ios - 打开xCode项目时文件夹 “Icons.xcassets”不存在

ios - UIBarButton点击区域比customView大

ios - Cocoapods Post_Install 脚本错误