UINavigationItem 是 UINavigationBar 上的东西

导航栏是通过push与pop的堆栈操作来对item进行管理的,同样,每一个Item自身也有许多属性可供我们进行自定制。

Item,从英文上来理解,它可以解释为一个项目,因此,item不是一个简单的label标题,也不是一个简单的button按钮,它是导航栏中管理的一个项目的抽象。说起来有些难于理解,通过代码,我们就能很好的理解Item的意义。

以下是一些方法和属性

 1 //NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationItem : NSObject <NSCoding>
 2 //
 3 //初始化一个带有文本的UINavigationItem
 4   - (instancetype)initWithTitle:(NSString *)title NS_DESIGNATED_INITIALIZER;
 5   - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
 6 //
 7 //设置和获取UINavigationItem的文本
 8   @property(nullable, nonatomic,copy)   NSString        *title;             // Title when topmost on the stack. default is nil
 9 //设置一个View类型的item:
10   @property(nullable, nonatomic,strong) UIView          *titleView;         // Custom view to use in lieu of a title. May be sized horizontally. Only used when item is topmost on the stack.
11
12 //这段文字会显示在item的上方:
13   @property(nullable,nonatomic,copy)   NSString *prompt __TVOS_PROHIBITED;     // Explanatory text to display above the navigation bar buttons.
14
15 //一个UINavigationItem中,还可以包含许多BarButtonItem,BarButtonItem是一系列的按钮,会出现在导航栏的左侧或者右侧
16 //设置返回按钮
17   @property(nullable,nonatomic,strong) UIBarButtonItem *backBarButtonItem __TVOS_PROHIBITED; // Bar button item to use for the back button in the child navigation item.
18 //
19 //设置在push出来新的item的时候,隐藏前面的返回按钮
20   @property(nonatomic,assign) BOOL hidesBackButton __TVOS_PROHIBITED; // If YES, this navigation item will hide the back button when it‘s on top of the stack.
21   - (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated __TVOS_PROHIBITED;
22 //
23 ///* Use these properties to set multiple items in a navigation bar.
24 // The older single properties (leftBarButtonItem and rightBarButtonItem) now refer to
25 // the first item in the respective array of items.
26 //
27 // NOTE: You‘ll achieve the best results if you use either the singular properties or
28 // the plural properties consistently and don‘t try to mix them.
29 //
30 // leftBarButtonItems are placed in the navigation bar left to right with the first
31 // item in the list at the left outside edge and left aligned.
32 // rightBarButtonItems are placed right to left with the first item in the list at
33 // the right outside edge and right aligned.
34 // */
35 //设置左右按钮组
36   @property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *leftBarButtonItems NS_AVAILABLE_IOS(5_0);
37   @property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *rightBarButtonItems NS_AVAILABLE_IOS(5_0);
38   - (void)setLeftBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0);
39   - (void)setRightBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0);
40 //
41 ///* By default, the leftItemsSupplementBackButton property is NO. In this case,
42 // the back button is not drawn and the left item or items replace it. If you
43 // would like the left items to appear in addition to the back button (as opposed to instead of it)
44 // set leftItemsSupplementBackButton to YES.
45 // */
46 //是否隐藏返回按钮,
47   @property(nonatomic) BOOL leftItemsSupplementBackButton NS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED;
48 //
49 //// Some navigation items want to display a custom left or right item when they‘re on top of the stack.
50 //// A custom left item replaces the regular back button unless you set leftItemsSupplementBackButton to YES
51 //设置左右按钮
52   @property(nullable, nonatomic,strong) UIBarButtonItem *leftBarButtonItem;
53   @property(nullable, nonatomic,strong) UIBarButtonItem *rightBarButtonItem;
54   - (void)setLeftBarButtonItem:(nullable UIBarButtonItem *)item animated:(BOOL)animated;
55   - (void)setRightBarButtonItem:(nullable UIBarButtonItem *)item animated:(BOOL)animated;
56 //
57   @end
时间: 2024-08-13 21:36:21

UINavigationItem 是 UINavigationBar 上的东西的相关文章

架构上面的东西,越少越好

比如说 传统的php web程序,不管你是nginx 还是httpd 进来,还是要经过php 进来,然后连mysql ,redis ,mongodb ,不能说你用了nginx 就快了多少. nginx真正牛笔之处在于第三方模块,比如说lua ,本身可以处理httpd的请求,还可以联合其他模块,比如说drizzle 可以直接访问mysql .这样就完全绕过了php 这个大家伙,性能提高那是必须的.光用nginx 当web server ,没啥优势,其实. 当然这个是建立在你能自行开发网站或者2次开

ftp在命令行状态下下载跟上传东西

假设FTP服务器的地址是192.168.1.100 1 进入dos的FTP界面,有两种方式,一种是:开始--运行--FTP--在cmd界面下输入命令open 192.168.1.100 另一种是 开始--运行--cmd--输入ftp 192.168.1.100 如果ftp的端口号不是默认的21号端口,那么还要在后面空格加端口号,如端口号是10000 例如 ftp 192.168.1.100 10000 2它会提示输入用户名username 它会提示你输入密码:password 注意:密码不显示出

电脑与笔记本如何能连接上传东西?

电脑与笔记本如何能连接上传东西? 我想con 上往笔记本里面传东西(没有移动硬盘没有网络) 首先两台电脑都得有网卡(呵呵,好白),然后得有一跟数据线(网线的交叉线,一头是56A标准的,一头是56B标准的)你可以去电脑城里面买交叉线或者让人家帮你夹一根.有了上面两点就可以传东西了. 步骤:1.把两台电脑用交叉线接起来. 2.两台电脑设置同一工作组.(右击我的电脑 属性 计算机名 看看是不是都在WORKGROUP这个工作组里面.) 3.在开始 设置 网络连接 本地连接 属性 TCP/IP里面设置内网

&lt;asp:FileUpload ID=&quot;FileUpload1&quot; runat=&quot;server&quot; /&gt;不上传东西问题

<asp:FileUpload ID="FileUpload1" runat="server" />不上传东西 Request.Files.Count也不为零,所以要在后面再加上一个条件Request.Files[0].ContentLength!=0 if (Request.Files.Count != 0 && Request.Files[0].ContentLength!=0) 这样当不上传东西时条件才为正确的啊 <asp:F

如何才在微信上卖东西不会被人拉黑? 在微信上究竟应该怎么样卖东西??

1.学会选择工具 你可以忍受一个人,一天到晚在朋友圈里面发广告吗?你可以忍受在工作的时间有一个人在你的窗外,用高音喇叭不停的吆喝吗? 己所不欲勿施于人.做一个有专业的微商,你要首先知道如何选择微商的工具.你注意罗永浩卖东西用的是什么吗?是公众号! 2.必须有技术支持 一个微商和街头小贩的差别是什么?是科技,是大数据.所以假如你连一个微信菜单都弄不出来也不知道大数据是什么东西?你没法做好一个微商. 3.服务在先 微商不是面对面,而是隔着互联网,所以在有人在线向你咨询的时候你必须知道,他有可能是一个

python从网站上下载东西

import requestsres=requests.get('http://www.gutenberg.org/cache/epub/112/pg112.txt')#requests返回一个res对象res.raise_for_status()#在resquests对象上调用raise_for_status()方法.如果文件出错,这将抛出异常,如果下载成功,就什么也不做.#此外也可以通过这样的语句来检查下载是否成功.#res.status_code==requests.codes.ok如果下

在Tomcat上跑东西时遇到的对我这样新手来说很难找到的问题

项目描述:通过访问index.jsp,展现一个简单的界面,有用户名,密码,验证码,和登录按钮, 项目实现的东西:通过提前设定定好的username和pwd登录,主要就是验证码的获得和比对: 遇到的问题:验证码的生成我是直接利用第三方jar包,然后呢,开始的时候我就直接把该jar包添加到我的个人library了,当项目运行起来的时候,结果是验证码图片无法获得,得到的错误是classNotFound,然后呢,菜逼的我,把项目又copy一份,还是遇到同样的错误,,,,,,最后,把个人仓库干掉,直接把他

如何在UINavigationBar上添加UISearchBar以及UISearchDisplayController的使用 --OC --iOS

那我们开始吧,下面是Sely写的一个Demo,分享给大家. 新建一个项目, UISearchDisplayController 的 displaysSearchBarInNavigationBar太死板了,达不到想要的效果. 这里进行重新定制, 四个协议, 三个成员变量,第一步OK. @interface ViewController ()<UISearchBarDelegate,UISearchDisplayDelegate, UITableViewDataSource, UITableVie

IOS:UI设计之UINavigationController,NavigationBar,ToolBAR相关基础

基本概念:导航视图控制器(UINavigationController)是用于构建分层应用程序的主要工具,管理着多个内容视图的换入和换出,并且自身提供了视图切换的动画效果(例如:相册,QQ,微信等APP应用). 它的父类是UIViewController,是所有视图控制器的基类,导航控制器以栈的形式来实现,其本身也属于视图控制器. 下图是UINavigationController的分层结构图: UINavigationController view层级 栈的基本概念与性质: 栈是一种数据结构,