Установите заголовок для элемента управления навигацией - PullRequest
1 голос
/ 08 октября 2011

Я преобразовал оконное приложение в навигационное, но не могу установить заголовок для навигационной панели.

controller = [[bookDisplayViewController alloc] initAndCreateView];

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
nav.title=@"Application";
[window addSubview:nav.view];

Ответы [ 2 ]

2 голосов
/ 08 октября 2011

Можно ли разместить

self.navigationItem.title = @"YourName";

в viewDidLoad другого представления? Я бы попробовал так и посмотрел, работает ли он.

1 голос
/ 08 октября 2011

Вы должны установить заголовок из UIViewController. Попробуйте это:


controller.navigationItem.title=@"Application";

Infact Apple docs на UINavigationItem для свойства title указывает, что:

title
A localized string that represents the view that this controller manages.

@property(nonatomic, copy) NSString *title
Discussion
Subclasses should set the title to a human-readable string that represents the view to the user. If the receiver is a navigation controller, the default value is the top view controller’s title.

Availability
Available in iOS 2.0 and later.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...