从 barbuttonitem 切换视图? [英] Switching views from barbuttonitem?

查看:45
本文介绍了从 barbuttonitem 切换视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我之前看到过与此类似的问题,但没有帮助.我也阅读了 Apple 的文档,但我不明白我哪里出错了.AFAIK 我按逻辑做了所有事情,但是当我单击 UItoolbar 覆盖层上的完成按钮时,可以按下该按钮,但它什么也不做.这显然意味着它无法确认编写的代码.但是如何?

So I've seen previous questions similar to this but they were of no help. I've read Apple's documentation too but I could not understand where I've gone wrong. AFAIK I did everything logically, but when I click on my done button on an UItoolbar overlay, the button can be pushed but it does not do anything. This obviously means it fails to acknowledge the written code. But how?

当在我的 UIToolBar 上单击完成按钮时,我想调出TableViewController"的 .nib.但是下面的内容不允许单击以显示新视图.我该如何纠正?请告诉我哪里出了问题,应该更换什么以及为什么.

I want to bring up the .nib of "TableViewController" when a done button is clicked on my UIToolBar. But the below isn't allowing the click to bring up a new view. How do I rectify this? Please show me where I went wrong and what should be replaced and why.

//Here's the selector:
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemDone target:self  action:@selector(doneButtonPressed)];

这是我如何采取行动的.顺便说一句,uitoolbar 没有笔尖,它是 imagepickercontroller(相机模式)上的一个叠加层.

Here's how I made my action. Btw, the uitoolbar has no nib, it's an overlay on the imagepickercontroller(camera mode).

-(void)doneButtonPressed {
TableViewController *tableView = [[TableViewController alloc]
initWithNibName:@"TableViewController" bundle:nil];
tableView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:tableView animated:YES];
}


//Yet nothing happens when I click on my done button on my overlay. The button can be
clicked nothing happens. Please shed any insight pleasee!

推荐答案

这实际上可能不是问题所在,但如果您在上面使用的代码是您解除 Modal 视图控制器的方式,则它是不正确的.除了可能的不当使用之外,我没有发现任何问题.

This may not actually be the problem, but if the code your using above is how you're dismissing your Modal view controller it is incorrect. Other than possible improper usage I don't see any problems.

使用您正在使用的内容来呈现模态视图控制器,然后使用以下内容关闭它:

Use what you're using to present the Modal view controller, then to dismiss it use this:

[self dismissModalViewControllerAnimated:YES];

这篇关于从 barbuttonitem 切换视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆