Is there a way to automatically set the tab bar and toolbar titles using the title of the View Controller?

I'm currently manually double clicking the tab bar titles to rename it from Item to the title of the View Controller it points to, and then also doing the same thing for the toolbars. I was thinking it'd be nice if it would be set automatically based on the title of the View Controller (settable in the sidebar). It seems a bit silly to have the exact same text in three locations - it'd be a good opportunity for a typo or inconsistency between the three.

enter image description here

有帮助吗?

解决方案

You can add self.navigationItem.title = self.title; to the - (void)viewWillAppear:(BOOL)animated of each one of your's UIViewController.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top