根视图控制器

发布于 2024-08-09 05:57:29 字数 219 浏览 3 评论 0原文

我现在正在学习这个,所以问题可能有点幼稚。这就是我正在尝试做的事情。我的第一个视图显示了静态填充的表格单元格,当您选择其中一个单元格时,它将弹出一个表单来输入数据。

现在,我一直在阅读有关导航按钮和导航的文档,似乎我需要两个单独的 viewController。一个用于基本应用程序,另一个用于在选择单元格时提出的新页面。这是正确的吗?

抱歉,这可能有点基本,但我不知道在这里该怎么做。谢谢。

I'm learning this right now so the questions might be a little juvenile. Here's what I'm trying to do. I have the first view come up with a cell of the table populated statically, when you select one of the cells it will pull up a form to input data.

Now, I've been reading the documentation about navigation buttons and navigation in general and it seems that I need two separate viewControllers. One for the basic app and another for the new page being brought forward when the cell is picked. Is this correct?

Sorry, this might be a little bit basic but I'm not sure what to do here. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

深府石板幽径 2024-08-16 05:57:29

这是正确的。您将有两个视图控制器:一个“根”视图控制器,它是最顶层的视图,第二个视图控制器包含编辑表单。

当您点击单元格时,第二个视图控制器将推送到导航堆栈上。

That is correct. You would have two view controllers: a "root" view controller that is the top-most view, and the second view controller that contains the editing form.

The second view controller would get pushed onto the navigation stack when you tap a cell.

何必那么矫情 2024-08-16 05:57:29

基本上,您需要创建第二个 UIViewController 子类,在切换视图时,该视图控制器需要附加到您的主窗口。

-(IBAction) SwitchView:(id)sender
{
MySubViewController *subViewController = [[MySubViewController] alloc]
                                         initWithNibName:@"SubView" bundle:nil];
self.view insertSubView:subViewController.view atIndex:0];
[subViewController release];
}

Basically you need to create a second UIViewController subclass, this viewcontroller needs to be attached to your main window when switching views.

-(IBAction) SwitchView:(id)sender
{
MySubViewController *subViewController = [[MySubViewController] alloc]
                                         initWithNibName:@"SubView" bundle:nil];
self.view insertSubView:subViewController.view atIndex:0];
[subViewController release];
}
不一样的天空 2024-08-16 05:57:29

是的,您需要两个视图控制器。

查看斯坦福大学 CS193P iPhone 应用程序编程课程的第 7 课。它可以在线获取。两张幻灯片和讲座均通过 iTunes U 提供。

CS193P iPhone 应用程序编程

我真的很喜欢观看课程!

Yes, you need two view controllers.

Check out lesson 7 from Stanfords CS193P iPhone Application Programming course. It is available online. Both slides and the lecture through iTunes U.

CS193P iPhone Application Programming

I really enjoyed watching the course!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文