How to remove UINavigationbar prompt programmatica

2019-06-18 19:22发布

问题:

I have a view controller, and I set the navigation bar with prompt in IB. But I want to remove the prompt and make the bar as "1 line" sometimes. how can I do it in code?

回答1:

[[self navigationItem] setPrompt: nil];

This animates the removal of the prompt.