gpt4 book ai didi

ios - UINavigationBar 的奇怪行为

转载 作者:行者123 更新时间:2023-11-28 22:13:12 25 4
gpt4 key购买 nike

经过数小时的不成功研究,这是我的问题。

自从我的应用程序开发之初,navigationBar.topItem.title 不起作用,所以我决定创建自己的子类,但仍然存在问题。

这是我的代码:

- (id)initWithFrame:(CGRect)frame {

self = [super initWithFrame:frame];

if (self) {

NSLog(@"NavBar Ready !");

self.topItem.title = @"something";

NSLog(@"%@", self.class);
NSLog(@"%@", self.topItem.class);
NSLog(@"%@", self.topItem.title.class);


}
return self;
}

编辑

这是控制台输出,如您所见,topItem类有问题,但此属性是只读,所以我不能allocinit 任何 UINavigationItem

2014-03-13 17:25:34.063 CCE[63471:60b] NavBar Ready !
2014-03-13 17:25:34.064 CCE[63471:60b] CCENavigationBar
2014-03-13 17:25:34.065 CCE[63471:60b] (null)
2014-03-13 17:25:34.065 CCE[63471:60b] (null)

所以这是我的问题......发生了什么,我能做些什么来解决它?

谢谢 SO 社区!

最佳答案

在我的项目(使用 Storyboard)中,ViewControllers 嵌入到 NavigationController 中,如果我设置:

self.title= @"title";

设置导航栏的标题。你试过这样设置吗?

关于ios - UINavigationBar 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22384776/

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