iOS-添加UINavigation

来源:互联网 发布:淘宝闲鱼怎么交易流程 编辑:程序博客网 时间:2024/05/24 01:05

好久没有用过navigation,现在又要重新用都有很多忘记了。


1.新建的是SingleViewApplication



2.然后呢,在AppDelegate.h中插入ViewController.h头文件



3.在AppDelegate.m中加入代码:


代码如下:

    ViewController *viewController = [[ViewController allocinit];

    viewController.title = @"hey Girl";

    UINavigationController *navigationController = [[UINavigationController allocinitWithRootViewController:viewController];

    navigationController.navigationBar.backgroundColor = [UIColor blueColor];

    [self.window setRootViewController:navigationController];

    [self.window makeKeyAndVisible];


4.得出的效果如图:



0 0
原创粉丝点击