我已经查看了所有类似/相关的问题,但没有一个是a)完全是我的问题,或者2)解决方案不起作用。
在我的 appDelegate.m 中,我有 didFinishLaunchingWithOptions
JCGRootNavigationController *rnc = [[JCGRootNavigationController alloc] init];
self.window.rootViewController = rnc;`
JCGRootNavigationController 是 UINavigationController 的子类
@interface JCGRootNavigationController : UINavigationController`
在 JCGRootNavigationController.m 中:
@implementation JCGRootNavigationController
-(instancetype) init {
self = [super init];
self.view.backgroundColor = [UIColor lightGrayColor];
self.navigationItem.title = @"MY TITLE";
return self;
}
并且标题不会显示。我看到导航栏,但没有标题。看来这些年来很多人都遇到过同样的问题。也许一个简单的答案将有助于消除所有困惑。这真是令人难以置信的令人沮丧。
使用 Storyboard 时,设置title
of the UIViewController
or UITableViewController
正如其他答案所暗示的那样,似乎没有将该标题添加到导航控制器中。
相反,找到UINavigationItem
它可能与故事板层次结构中的视图控制器对象一起。设置此导航项的title
将该标题应用于导航控制器。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)