I have an XCode project for the iPhone. The UI Hierarchy looks like this:
MainWindow
UINavigationController
RootView
(derives fromUIView
)NestedView1
(derives fromUIView
)NestedView2
(derives fromUIView
)
-
开发者_如何学Go
This should be a typical setup for many projects. The app starts from RootView
and as a result of some user action the RootView
changes to NestedView1
, then back to RootView
, then to NestedView2
.
Is there any way to set the title displayed in the Navigation Bar from within Interface Builder, as opposed to calling [self setTitle: @"Nested View X"];
from the code of each View Controller? What I'd like to have is opening a XIB of each of the View Controllers, selecting something visually and setting the title in the Inspector. Is this possible somehow?
Or maybe there is another approach not to have strings in the code for better localization?
Apple have many resources available on how to localise your apps, there is a directory of them here.
In particular, read this bit about localising strings.
click on the RootView in the interface builder you will find a navigation item component in the RootView, click on that component and you will find in the "Attribute Inspector" window a title field, write there the title that you want.
精彩评论