Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
好的,所以我首先向您解释一下您做错了什么:
推送的视图控制器将自动继承超级(推送它的视图控制器)导航栏(这意味着您可以在子级中调用 self.navigationController视图控制器,因为 UINavigationController 只是 UIViewController 的子类(UITableViewController 也是如此),
这就是您需要做的:
但是,对于您想要做的事情,最好以模态方式呈现视图控制器,这意味着您必须将其保存在导航控制器中。具体方法如下:
请注意,您需要在 AddProjectViewController 类中创建 UIBarButtonItems
我已更新您的代码并将其上传到此处: http://dl.dropbox.com/u/5445727/Zum.zip
希望它有所帮助,您需要查看此处的评论,我没有将它们转移到你的项目中,祝你好运:)
OK, so I'll just explain to you what you're doing wrong first:
The pushed view controller will automatically inherit super's (the view controller that's pushing it) navigation bar (which means you can make calls on self.navigationController in the child view controller, since UINavigationController is simply a subclass of UIViewController (and so is UITableViewController).
Here's what you need to do:
However, for what you're trying to do, it would be much better to present the view controller modally, which means you will have to hold it inside a navigation controller. Here's how:
Note that you need to create UIBarButtonItems in your AddProjectViewController class.
I have updated your code and uploaded it here: http://dl.dropbox.com/u/5445727/Zum.zip
Hope it helps, you'll need to look at the comments here, I didn't transfer them to your project. Good luck :)