How can I make my UINavigationController
display a prompt when a button is pressed? I have already set my text by [[[self navigationController]navigationItem]setPrompt:[NSString stringWithFormat:@"Prompt is working!"]];
EDIT:
To clarify, I have a button calling an IBAction
that sets the prompt as follows but I need to find a way to display the prompt as soon as that button is pressed:
-(IBAction)test:(id)sender
{
[[[self navigationController]navigationItem]setPrompt:[NSString stringWithFormat:@"Prompt works!"]];
//I want it to display right after I set it, so I'm missing something and can't figure it out through the documentation
}
I have already tried [[[self navigationController]navigationBar]pushNavigationItem:nav animated:YES];
but that throws an error stating Cannot call pushNavigationItem:animated: directly on a UINavigationBar managed by a controller.
You should set the prompt text like this:
self.navigationItem.prompt = @"This is the title";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With