Search code examples
iosuinavigationbarprompt

Add Prompt to UINavigationBar Programmatically


How do I programmatically make my UINavigationBar (which doesn't have a UINavigationController) have a prompt whom's text value equals webTitle.

I've tried the following with no luck:

self.navigationItem.prompt = webTitle;

The only way I have been able to create a prompt is by applying the following settings onto the NavigationBar in IB.

Yeah


Solution

  • Proper way is

    self.navigationItem.prompt = @"Hello";