Xcode 4:将视图切换到 MainWindow.xib
我对 Objective-C 和 Xcode 还很陌生,所以如果你能给出详细的答案将会非常有帮助。我正在使用基于导航的应用程序,并且有一个菜单。如果用户单击特定按钮,则应加载表格视图和导航栏。但我不知道如何加载“MainView.xib”。我可以加载“RootViewController”,但这仅显示表格视图,而不显示导航栏。
提前致谢!
I'm pretty new to Objective-C and Xcode, so it would be really helpful if you could give a detailed answer. I'm working with a Navigation-Based Application and I have a menu. If the user clicks on a specific button, the tableview and the navigation bar should load up. But I don't have a clue on how I could load up the "MainView.xib". I can load the "RootViewController", but this only shows the tableview and not the navigation bar.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MainView.xib
通常在UIApplicationMain
函数中自动加载,该函数在main.m
文件中调用。如果你想用导航栏推送视图,你应该创建一个 UINavigationController (通常不需要子类化),并将你的 RootViewController 对象设置为导航控制器的根视图控制器。或者,如果您想在 xib 文件中完成所有操作,您可以将 UINavigationController 拖入其中并将根视图控制器放入其中。更多信息位于 查看控制器编程指南。MainView.xib
is usually loaded automatically within theUIApplicationMain
function, which is called in yourmain.m
file. If you want to push a view with a navigation bar, you should create a UINavigationController (there's usually no need to subclass), and set your RootViewController object as the navigation controller's root view controller. Or, if you want to do it all in your xib file, you can drag a UINavigationController in and put your root view controller inside it. More info is in the View Controller Programming Guide.