将另一个视图添加到基于视图的应用程序
我正在开发一个 iPhone 应用程序,它将一些数据存储到数据库中。效果很好。但现在当我想显示数据时遇到问题。因为要显示数据我需要设计另一个视图。但是当我尝试添加另一个视图时,我遇到了问题。在基于视图的应用程序中是否可以有多个视图,因为我的应用程序是基于视图的应用程序?如果是的话该怎么做?请帮助我
提前致谢 喜悦
I'm developing an iphone apllication that stores some data into a database. That is working fine. But now i have a problem when i want to show the data. Because to show the data i need to design another view. But i'm facing problem when i try to add another view.Is it possible to have multiple view in a view-based application,cause my application is a view-based application? If yes then how to do that? Please help me
Thanks in advance
Joy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。原则上,您创建新视图 [alloc/init],然后显示它。
通常,您可以通过将其推入导航控制器堆栈来显示它。
[self.navigationController PushViewController:newViewControllerAnimated:YES];
如果你没有导航控制器,你要么需要创建一个(你最好的选择可能是使用 xcode 来制作一个基于导航的应用程序并看看它是如何组合在一起的)。
如果您只想简单地显示第二个视图控制器,那么您可以将其显示为模态视图控制器:分配/初始化您的第二个视图控制器,然后使用
[selfpresetModalViewController:newViewContolleranimated:YES];
最后你可以做一个前视图/反面视图。看一下 xcode 中的实用程序应用程序模板。
yes. In principle you create your new view [alloc/ init], then display it.
Normally you would display it by pushing it onto the navigation controller stack.
[self.navigationController pushViewController:newViewController animated:YES];
If you don't have a navigation controller, you either need to create one (your best bet might be to use xcode to make a navigation based application and take a look at how its put together).
If you just want to simply display a second view controller, then you can display that as a modal view controller: alloc/init your second view controller then display it with
[self presetModalViewController:newViewContoller animated:YES];
Finally you could do a front view/ flipside view. Take a look at the utility application template in xcode.
是的,可以使用多个视图。您可以使用
addSubView
手动将它们添加到窗口。您还可以使用视图控制器,例如 UINavigationController 或 UITabBarController。
这取决于您想要如何显示视图以及用户如何在视图之间切换。
Yes it is possible to use multiple views. You can manually add them to the window by using
addSubView
.You can also use a view controller like a UINavigationController or a UITabBarController.
It depends on how you want to display the views and how the user can switch between them.