首页 > 其他分享 >iOS学习之UINavigationController…

iOS学习之UINavigationController…

时间:2023-04-30 20:33:38浏览次数:32  
标签:flexItem alloc target nil iOS 学习 UINavigationController UIBarButtonItem initWith


1、显示Toolbar 

在RootViewController.m的- (void)viewDidLoad方法中添加代码,这样Toobar就显示出来了。





1.  setToolbarHidden:NO animated:YES];



iOS学习之UINavigationController…_数组



2、在ToolBar上添加UIBarButtonItem

新建几个UIBarButtonItem,然后以数组的形式添加到Toolbar中





1. *one = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];  
2.    UIBarButtonItem *two = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:nil action:nil];  
3.    UIBarButtonItem *three = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];  
4.    UIBarButtonItem *four = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:nil action:nil];  
5.    UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];  
6.    [self setToolbarItems:[NSArray arrayWithObjects:flexItem, one, flexItem, two, flexItem, three, flexItem, four, flexItem, nil]];



效果:




[self.navigationController.toolbar setItems:(NSArray *) animated:

标签:flexItem,alloc,target,nil,iOS,学习,UINavigationController,UIBarButtonItem,initWith
From: https://blog.51cto.com/u_548275/6238192

相关文章

  • iOS 开发-控制器间跳转
    if(self.view.superview==nil){[singleDollController.viewremoveFromSuperview];[self.viewinsertSubview:rootViewController.viewatIndex:0];}else{removeFromSuperview];atIndex:0];}视图间的跳转1.AddInfo*control=[[AddInfoalloc]init];[selfpr......
  • OOP面向对象第二个月学习总结
    OOP面向对象第二个月学习总结目录 · 前言 · 设计与分析 · 踩坑心得 · 改进建议 · 总结 一、前言这个月的学习相比上个月的学习,难度就提升了极多,为了让我们更好的理解面向对象的几个特点和原则,题目以及作业的难度,复杂度,综合性增加了许多。主要有几次实验,......
  • dwr学习之提高篇
    在本人的这篇文章的基础上http://chenzheng8975.iteye.com/blog/1842080深入学习: dwr工具类:<scripttype="text/javascript"src="<%=request.getContextPath()%>/dwr/util.js"></script>dwr转化对象和异常:<convertconverter="bean"match=&q......
  • ibatis学习之一对多关联
    基于本人的这篇文章http://chenzheng8975.iteye.com/blog/1718765的基础上,对ibatis进行深入的学习:Clazz.java:packagecom.cz.model;importjava.util.ArrayList;importjava.util.List;publicclassClazz{ privateintid; privateStringclassname; privateList<Stud......
  • 网页编辑器学习之xheditor
    因为工作需要就学习了一下网页编辑器方面的知识,我总结了一下,比较流行的网页编辑器有CKeditor或者也可以叫做fckeditor,我也动手做了实际的案例发现可以跑起来,就是那个上传的文件管理感觉不太好,所以看了一下csdn的编辑器用的是xheditor所以就在网上找了一下相关的知识。http://h5566h......
  • Struts2标签学习
    <td><s:iftest="%{#l.res_scope==1}">完全共享</s:if><s:elseiftest="%{#l.res_scope==2}">班级共享</s:elseif><s:else>好友共享</s:else></td><h3>发布资源</h3&......
  • ibatis学习注意事项
    1.对于多参数的问题:在ibatis中,会发现其输入参数只能有一个,于是当出现需要进行多个输入参数的时候,就要想点办法了,我看到的有以下两种比较好的方法能够解决这个问题用String代替<selectid="checkLogin"parameterClass="java.lang.String"resultClass="java.lang.Integer">SELECT......
  • 堆与二叉搜索树学习笔记
    部分内容来自OI-WIKI。1.堆堆的定义堆是一棵二叉树,满足每个节点的键值都大于等于它的父亲节点或者小于等于它的父亲节点。每个节点的键值都大于等于它的父亲节点的叫小根堆,每个节点的键值都小于等于它的父亲节点的叫大根堆。优先队列是一种抽象数据类型,它是一种容器,里面有......
  • Http学习之使用HttpURLConnection…
    post请求的OutputStream实际上不是网络流,而是写入内存,在getInputStream中才真正把写道流里面的内容作为正文与根据之前的配置生成的httprequest头合并成真正的http request,并在此时才真正向服务器发送。函数可以改变这个模式,设置了ChunkedStreamingMode后,不再等待Out......
  • IOS上传图片的方法
    下面是图片上传的方法:-(void)loadImage:(NSString*)aurl{NSData*imageData;NSMutableData*postBody;NSString*stringBoundary,*contentType;NSURL*url=[NSURLURLWithString:aurl]......