うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

Show title to NavigationBar by Coding

Japanese here

uchinoinu.hatenablog.jp

Standard Way

Set title property in NavigationItem of NavigationController

self.navigationItem.title = "title"

Popular Failure

self.navigationController.title = "title"

Rapid Way

Set title property of UIViewController

self.title = "title"

Demerit

In UIViewController, self.title is read by lots of places.

For example, tabBarItem may be overwritten by self.title.

In other words, some bad effect may be happened.