[英]How to create “UINavigationController” with backbutton in Xcode (xib)?
thank you for taking time to answer me ! 感谢您抽出宝贵时间回答我!
I'm inexperienced in IOS development, after several searches on google, I turn to you. 我在IOS开发方面经验不足,在Google上进行了几次搜索后,我求助于您。
My problem is that : I will wish to use UINavigationController, with new main view, to allow me to create a back button. 我的问题是:我希望将UINavigationController与新的主视图一起使用,以允许我创建后退按钮。
Here is my AppDelegate.m : 这是我的AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
MainViewController *mvc = [[MainViewController alloc]init];
//self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
//UINavigationController * navController = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = mvc;
[self.window makeKeyAndVisible];
return YES;
}
and my AppDelegate.h : 和我的AppDelegate.h:
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
//@property (strong, nonatomic) ViewController *viewController;
@end
During development I changed the main view of the application as you can see above the two lines commented out. 在开发过程中,我更改了应用程序的主视图,正如您在注释两行上方看到的那样。
I would like to use "UINavigationController" with this new main view, what does it change? 我想在这个新的主视图中使用“ UINavigationController”,它会发生什么变化? and where?
在哪里?
Thank you and sorry if i'm not clear ! 谢谢,对不起,如果我不清楚的话! (Google Translate)
(谷歌翻译)
Set your MainViewController *mvc
as the root of your navController
and make it the root view controller of the window. 将
MainViewController *mvc
设置为navController
的根,并使其成为窗口的根视图控制器。
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController: mvc];
self.window.rootViewController = navController;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.