gpt4 book ai didi

ios - 如何在 UITableViewController 中使用段 Controller 设置导航栏标题?

转载 作者:行者123 更新时间:2023-11-29 05:31:43 26 4
gpt4 key购买 nike

我怎样才能实现这样的enter image description here

UITableView Controller 中,不在 UIViewController 中。

这里我使用 SAP Fiori 组件进行设计。

到目前为止,我尝试使用导航栏提示的 ui 形式 storybard:enter image description here

这是到目前为止我尝试过的代码:

      self.navigationController?.makeBlackNavigationbar()
self.navigationController?.navigationBar.makeBlackNavigationBar()
let items = ["Label A", "Label B"]
segmentedController = UISegmentedControl(items: items)
segmentedController.frame = (self.navigationController?.toolbar.bounds)!
self.navigationController?.toolbar.addSubview(segmentedController)

extension UINavigationController
{
func makeBlackNavigationbar (){

print("black navigation")

navigationController?.isNavigationBarHidden = false
}
}

extension UINavigationBar
{

func makeBlackNavigationBar ()
{
barTintColor = UIColor(red: 68/255, green: 94/255, blue: 117/255, alpha: 1)
let titleDict: NSDictionary = [NSAttributedStringKey.foregroundColor: UIColor.white]
titleTextAttributes = titleDict as [NSObject : AnyObject] as! [NSAttributedStringKey : Any]



}
}

非常感谢任何帮助..

最佳答案

How can i achieve like this

你不能。您可以将分段控件作为标题 View ,替换标题文本;但是您不能将分段控件同时用作标题 View 标题文本。

获得类似于第一个屏幕截图的唯一方法是通过精心设计的幻觉。您需要将分段控件放在导航栏外部,作为主视图的一部分,但周围有一个看起来像导航栏并融入其中的 View (因为导航栏本身没有可见的底部边缘或阴影)。

关于ios - 如何在 UITableViewController 中使用段 Controller 设置导航栏标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57475527/

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