gpt4 book ai didi

iOS - 以编程方式将 SegmentControl 替换为导航标题

转载 作者:行者123 更新时间:2023-11-28 19:45:25 24 4
gpt4 key购买 nike

我有一个 View Controller ,它的导航栏有一个段控件。现在我想重用这个 View Controller 来显示带有标题而不是段控件的其他内容。我试图将段控件的隐藏属性设置为 true 并设置 self.navigationController?.title = "foo",不幸的是,没有标题显示:(

如何以编程方式将 UISegmentedControl 替换为我的导航标题?

最佳答案

您必须设置 titleView property navigationControllernil 自文档状态

If this property value is nil, the navigation item’s title is displayed in the center of the navigation bar when the receiver is the top item. If you set this property to a custom title, it is displayed instead of the title. This property is ignored if leftBarButtonItem is not nil.

关于iOS - 以编程方式将 SegmentControl 替换为导航标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32540449/

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