• UINavigationBar


    UINavigationBar

    UINavigationBar是一个负责View跳转的控件。在NavigationBar下面允许存在子View

    屏幕快照 2016 04 14 上午11 03 16


    有二种方式可以创建UINavigationBar


    1. 代码篇
    创建2个Controller,一个继承自ViewController

    项目右键->NewFile->Cocoa Touch Class。

    屏幕快照 2016 04 14 上午11 11 19

    Subclass of:选择ViewController,创建一个ViewController

     屏幕快照 2016 04 14 上午11 12 58


    同样的方式在创建一个Controller
    Subclass of:UINavigationController


    我们在项目代码的AppDelegate.m文件中加入如下代码:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        // Override point for customization after application launch.

        //创建一个UIViewController

        UIViewController* vcontroller = [[UIViewControlleralloc]initWithNibName:nilbundle:nil];

        

        //创建一个NavigationController 包含一个viewController

        MyNavigationController* myncontroller = [[MyNavigationControlleralloc]initWithRootViewController:vcontroller];

        

        //window大小根据系统的硬件来

        self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen] bounds]];

        

        self.window.rootViewController = myncontroller;

        

        self.window.backgroundColor = [UIColorredColor];

        

        [self.windowmakeKeyAndVisible];

     

        returnYES;

    }




  • 相关阅读:
    C#:将子Form加入父Form中
    C#:简单线程样例
    C#:实现接口中定义的事件
    easyui设置界面的高度自适应
    JQuery
    vim常用命令(iOS)
    Linux的IO性能监控工具iostat详解
    php多线程抓取信息测试例子
    使用Gitosis搭建Git服务器
    CentOS 6.4 搭建git 服务器
  • 原文地址:https://www.cnblogs.com/kfsmqoo/p/5390362.html
Copyright © 2020-2023  润新知