的UIBarButtonItem不点击
从rootViewController
反应后,我浏览到一个UIViewController
的UIBarButtonItem不点击
if (self.contr == nil) {
ExampleViewController *controller = [[ExampleViewController alloc]
initWithNibName:@"Example"
bundle:[NSBundle mainBundle]];
self.contr = controller;
[controller release];
}
[self.navigationController presentModalViewController:self.contr animated:YES];
在的UIViewController我有
-(IBAction) goBack:(id)sender {
[self.navigationController dismissModalViewControllerAnimated:YES];
}
我加入了签名.h文件的方法。 在.xib
文件中,我有一个UIToolbar
和UIBarButtonItem
。我将按钮连接到文件的所有者 - goBack
:
所有内容都出现在屏幕上,但是当我单击按钮时,goBack
未被调用。我也试图用编程方式来做这件事,但我得到了同样的结果 - 一切都出现了,但对点击没有任何反应。
任何想法,为什么它不工作?
编辑: 我刚刚发现了一些不可见的东西在工具栏上。如果我点击某个特定点(在工具栏上),然后调用goBack:。由于我使用presentModelViewController导航到这个屏幕,导航栏没有出现......但可能它在那里,这就是隐藏工具栏。
呈现模态视图控制器不要求您通过UINavigationController
。我建议你可以改变:
[self.navigationController presentModalViewController:self.contr animated:YES];
[self.navigationController dismissModalViewControllerAnimated:YES];
这样:
[self presentModalViewController:self.contr animated:YES];
[self dismissModalViewControllerAnimated:YES];
让我知道,如果这有助于。
我试过了,但我没有达到goBack:无论如何。 – Adriana 2011-06-09 14:23:59
试试这个在GoBack方法:
[self.navigationController popToRootViewControllerAnimated:YES];
如果你不打,这意味着你没有在厦门国际银行正确连接它们的断点。
@Adriana Post Button声明代码 – Rams 2011-06-09 12:53:52
添加一行以检查发件人== UIBarButtonItem – Legolas 2011-06-09 14:09:40
您是否尝试过在'goBack'方法中插入对'NSLog'的调用,或者在其中设置断点以查看它是否为没有叫,或者如果它没有效果? – marzapower 2011-06-09 14:16:33