• UINavigationItem表示UINavigationBar中的控件


    一般一个程序中有一个UIWindow,一个UINavigationController,一个根UIViewController,多个子UIViewController。

    UIWindow是整个可视界面的容器,里面放置我们看到的UIView。
    UIView负责处理屏幕上一个矩形区域的绘制,UIView中还可包含子UIView。
    UIWindow是UIView类的扩展,可以看作是整个屏幕的根UIView。
    UIViewController负责管理UIView的层次结构。可以有多个UIViewController。

    一个UIViewController中有一个顶部的UINavigationBar、一个根UIView,多个子UIView。
    UINavigationBar中有一个UINavigationItem,UINavigationItem。

    UINavigationController是用于构建分层应用程序的主要工具,它维护了一个UIViewController栈。
    这个栈中必须有一个根UIViewController,其他的UIViewController都是子UIViewController。

    UINavigationItem表示UINavigationBar中的控件,比如左按钮、中间标题、右按钮。
    UINavigationController会自动在当前子UIViewController的UINavigationBar左边添加一个返回按钮。
    按钮名称是上一个UIViewController的标题。

    在UIViewController中有访问view、bar的属性和方法
    self.view.backgroundColor = [UIColor whiteColor]; //设置根UIView的颜色
    self.navigationItem.title = @"title"; //设置UINavigationBar的标题
    [self.navigationController popViewControllerAnimated:YES]; //弹出当前UIViewController

  • 相关阅读:
    Stopping User Manager for UID 121” error
    IDEA——如何再次开启ESLint
    堆排序
    akka-typed(10)
    微慕WordPress小程序专业版v3.0发布
    微慕WordPress小程序增强版v2.0发布
    微慕WordPress小程序开源版v3.6发布
    微慕小程序开源版A标签优化说明
    微信小程序开放「分享到朋友圈」功能
    微信小程序直播安装和开发指南
  • 原文地址:https://www.cnblogs.com/jackljf/p/3589021.html
Copyright © 2020-2023  润新知