Programmatically creating UINavigationController i

2019-01-18 06:45发布

I am new to iOS. And I want to use navigation controller in my application but I have no any idea how to do it. So can any one guide me step by step for creating navigation in my application.

7条回答
地球回转人心会变
2楼-- · 2019-01-18 07:48

Here is the code that you should write in app delegate.

UIViewController *vc=[[UIViewController alloc]initWithNibName:@"vc1" bundle:nil];
UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 568)];
view.backgroundColor=[UIColor redColor];
[vc setView:view];

self.navme=[[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = self.navme;
查看更多
登录 后发表回答