OStack程序员社区-中国程序员成长平台

标题: iphone - 如何访问和修改 UINavigationBar [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:19
标题: iphone - 如何访问和修改 UINavigationBar

我通过库将 UINavigationBar 添加到 View 。但我不知道如何从我的 ViewController.m 更改此 UINavigationBar。我的 View 还包括 TableView。此 View 必须从默认应用程序 View 中调用。

在 viewController.m 中,我添加了以下代码,但无法更改 NavigationBar 属性。

self.navigationItem.title=@"列表"; self.navigationItem.backBarButtonItem.title=@"Back";



Best Answer-推荐答案


我认为这是不同的 UINavigationBar 和 UINavigationItem.. 在 .h 文件中使用:

UINavigationItem *item;

在.m文件中:

item.title = @"List";

不要忘记将 UINavigationItem 与 XIB 文件中的“项目”连接起来 双击 UINavigationBar 你会得到 UINavigationItem... 祝你好运

关于iphone - 如何访问和修改 UINavigationBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7670098/






欢迎光临 OStack程序员社区-中国程序员成长平台 (http://ostack.cn/) Powered by Discuz! X3.4