我该如何让我的UINavigationController在按钮被按下时显示提示?我已经通过[[[self navigationController]navigationItem]setPrompt:[NSString stringWithFormat:@"Prompt is working!"]];设置了文本。
编辑:
为了澄清,我有一个按钮调用一个IBAction,它将提示设置如下,但我需要找到一种方法,在按下按钮时立即显示提示:
-(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
}
我已经尝试过[[[self navigationController]navigationBar]pushNavigationItem:nav animated:YES];
但是这会抛出一个错误,指出不能在由控制器管理的UINavigationBar上直接调用pushNavigationItem:animated: