Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation Controller Display Prompt

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 IBActionthat 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.

like image 651
Baub Avatar asked Nov 29 '22 15:11

Baub


1 Answers

You should set the prompt text like this:

self.navigationItem.prompt = @"This is the title";
like image 128
Ahmet Ardal Avatar answered Dec 07 '22 01:12

Ahmet Ardal