zoukankan      html  css  js  c++  java
  • 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;

    }




  • 相关阅读:
    Universal USB Installer集开源软件之佳作
    利用sdkman安装kotlin和java环境
    centos 7 安装docker
    CentOS 7 安装中文环境
    Using ADB and fastboot
    LinearGradient线型渐变效果
    将头图片变成圆形简单实现
    望远镜效果
    BitmapShader填充图形
    给图片加阴影效果简单示例代码实现
  • 原文地址:https://www.cnblogs.com/kfsmqoo/p/5390362.html
Copyright © 2011-2022 走看看