gpt4 book ai didi

ios - iOS 7 中 UINavigationbar 下面的 UISegmentedControl

转载 作者:IT王子 更新时间:2023-10-29 07:29:37 24 4
gpt4 key购买 nike

如何将 UISegmentedControl 作为其下方 UINavigationBar 的一部分?它是连接到 UINavigationBar 还是作为 subview 添加到 UINavigationController 的 View Controller 的完整独立 View 。看起来它是 UINavigationBar 的一部分,因为栏下方有一个阴影。

enter image description here

最佳答案

这是一个简单的效果。

首先,在工具栏中放置一个片段。将此工具栏放在导航栏的正下方。将工具栏的委托(delegate)设置为您的 View Controller ,并在 positionForBar: 中返回 UIBarPositionTopAttached。您可以在商店应用程序中看到,如果您执行交互式弹出手势,则分段栏不会像导航栏那样移动。那是因为它们不是同一个吧。

enter image description here

现在去除发际线。 “细线”是一个 UIImageView,它是导航栏的 subview 。您可以找到它并将其设置为隐藏。例如,这就是 Apple 在其原生日历应用程序以及商店应用程序中所做的。记得在当前 View 消失时显示它。如果您稍微玩过 Apple 应用程序,您会看到细线在 viewWillAppear: 中设置为隐藏,在 viewDidDisappear: 中设置为显示。

要实现搜索栏的样式,只需将栏的 searchBarStyle 设置为 UISearchBarStyleMinimal

关于ios - iOS 7 中 UINavigationbar 下面的 UISegmentedControl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21887252/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com