- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
这是一个非常简单的问题,但我不知道该怎么做。
我发现的第一件事是我必须添加一个导航 Controller 。虽然我不需要显示导航 Controller ,但我试过了。我找到了这些教程: http://www.ralfebert.de/tutorials/iosdev/navigationcontroller/
http://iosmadesimple.blogspot.de/2012/09/navigation-based-project-doing-it-using.html
和其他人,它说,我必须将导航 Controller 连接到窗口对象。但是在 .xib 中没有窗口对象。似乎有一些更新,我发现在 AppDelegate.m 中以编程方式创建的窗口对象
这是否意味着我必须以编程方式连接它们,如果是,如何连接?
我正在使用 Xcode 4.4.1 构建 5.1。
然后我发现了 hacky 方法,以替换此处描述的 View :http://fuelyourcoding.com/ios-basics-how-to-load-a-uiview-without-a-navigation-controller/
但我想知道这样做的标准方法是什么。
Apple 的开发指南中有一些关于 Storyboard的内容。这是我需要的吗?
我需要知道如何启动一个单独的新屏幕(当然有自己的 Controller 和 .xib),如果可能的话,而不必向应用程序添加导航栏。
最佳答案
最好的方法是使用导航 Controller 。
在 AppDelegate applicationWillFinishLaunchingWithOptions 中放这个...
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:<the view controller you want to use first>];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
这将使用 NavigationController 启动您的应用程序,您首先看到的将是您的初始 View Controller 。
隐藏栏...
在您的初始 View Controller 的 viewWillAppear 部分...
[self.navigationController setNavigationBarHidden:YES animated:YES];
这将隐藏该 Controller 的导航栏。
推送到新的 View Controller ...
MyNewViewController *newVc = [[MyNewViewController... (set it up).
[self.navigationController pushViewController:newVc animated:YES];
这是从初始 View Controller 完成的。
然后弹出。在新的 VC 中,只需执行此操作...
[self.navigationController popViewControllerAnimated:YES];
您永远不会真正“拥有”导航 Controller ,也永远不会真正看到它。它只是在您的应用程序后面管理转换和其他内容。
关于ios - 如何在 IOS 中启动新屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13440483/
我是一名优秀的程序员,十分优秀!