前言

UIToolbar以前也接触过,不过没有怎么用,久而久之就忘了他的存在,今天看别人源码的时候看见了,它怎么很方便,在排列一排视图的时候不需要我们算里面的坐标就可以轻松良好的把布局做出来

代码

    UIToolbar *tool = [[UIToolbar alloc]initWithFrame:CGRectMake(, , , )];
tool.layer.borderWidth = ;
tool.barStyle = UIBarStyleBlack;
tool.backgroundColor = [UIColor blackColor];
[self.view addSubview:tool]; //中间空余部分
UIBarButtonItem *space = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL]; UIBarButtonItem *previousItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"player_pause"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(previous:)];
UIBarButtonItem *previousItem1 = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"player_pause"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(previous:)];
UISlider *slider = [[UISlider alloc]initWithFrame:CGRectMake(, , , )];
UIBarButtonItem *volumnItem = [[UIBarButtonItem alloc]initWithCustomView:slider]; tool.items = @[space,previousItem1,space,volumnItem,space,previousItem];

效果图

被忽视的控件UIToolbar的更多相关文章

  1. iOS: 工具栏控件UIToolBar和工具栏按钮控件UIBarButtonItem的使用

    一.工具栏控件:UIToolBar:UIView 介绍: ToolBar工具栏是视图View的属性,可以在工具栏上添加工具栏按钮Bar Button Item(可以是自定义的Custom.也可以是系统 ...

  2. 【IOS 开发】基本 UI 控件详解 (UIDatePicker | UIPickerView | UIStepper | UIWebView | UIToolBar )

    转载注明出处 : http://blog.csdn.net/shulianghan/article/details/50348982 一. 日期选择器 (UIDatePicker) UIDatePic ...

  3. iOS:UIToolBar控件的使用

    UIToolBar控件:是经常使用的一个工具条控件,虽然在上面可以添加子控件,但是toolbar中只能添加UIBarButtonItem类型的子控件,其他子控件会被包装成这种类型的,例如UIButto ...

  4. Xamarin.ios 基本控件

    .按钮 UIButton UIButton btn = new UIButton(); btn.Frame = ,,,); //按钮位置一件宽高 btn.SetTitle("Button&q ...

  5. Duilib源码分析(二)控件构造器—CDialogBuilder

    上一节了解了大体流程,但是界面控件元素是如何被加载.解析.构建.管理.控件消息如何处理的呢?接下来我们将结合控件构造器进行分析: CDialogBuilder:控件构造器,主要用以解析xml配置文件并 ...

  6. iOS-UI-UI控件概述

    以下列举一些在开发中可能用得上的UI控件: IBAction和IBOutlet,UIView 1 @interface ViewController : UIViewController 2 3 @p ...

  7. UI--普通控件总结1--控件使用

    本文目录 0.UIView常用的属性和操作 0_1.UIView常见的属性 0_2.UIView状态 0_3.UIView常用的方法 1.文本框UITextField和文本视图UITextView 1 ...

  8. ios开发中经常用到的控件

    以下是按照使用频率对ios的控件进行罗列. 1.最常用的UI控件: UIButton (按钮).UILabel (文本标签).UITextField (文本输入框).UIImageView( 图片显示 ...

  9. 如何优化 FineUI 控件库的性能,减少 80% 的数据上传量!

    在开始正文之前,请帮忙为当前排名前 10 唯一的 .Net 开源软件 FineUI 投一票: 投票地址: https://code.csdn.net/2013OSSurvey/gitop/codevo ...

随机推荐

  1. Smack+OpenFire搭建IM通信,包含心跳和自动重连(Android实现)

    Smack是一个开源,易于使用的XMPP(jabber)客户端类库.优点:简单的,功能强大,给用户发送信息只需三行代码便可完成.缺点:API并非为大量并发用户设计,每个客户要1个线程,占用资源大.Op ...

  2. 深入浅出Android动态加载jar包技术

    在实际项目中,由于某些业务频繁变更而导致频繁升级客户端的弊病会造成较差的用户体验,而这也恰是Web App的优势,于是便衍生了一种思路,将核心的易于变更的业务封装在jar包里然后通过网络下载下来,再由 ...

  3. Jenkins执行shell脚本启动tomcat失败解决方法

    环境:Centos 7 Jenkins版本:2.124 状况:Jenkins会执行服务器某个目录下的Shell, 脚本中功能是复制替换某两个配置文件,然后关闭tomcat,重启Tomcat. 但是,T ...

  4. IOS之UI异步刷新

    NSOperationQueue     *operationQueue; // for rendering pages on second thread [operationQueue waitUn ...

  5. 大数据freestyle: 共享单车轨迹数据助力城市合理规划自行车道

    编者按:近年来,异军突起的共享单车极大地解决了人们共同面临的“最后一公里”难题,然而,共享单车发展迅猛,自行车道建设却始终没有能够跟上脚步.幸运的是摩拜单车大量的轨迹数据为我们提供了一种新的思路:利用 ...

  6. nGrinder技术架构图

  7. iOS打包上传app store各种问题解决总结

    问题1 this action could not be completed. try again 问题2 there was an error sending data to the iTunes ...

  8. Lesson1

    #ifdef __cplusplus #include <cstdlib> #else #include <stdlib.h> #endif #include <SDL/ ...

  9. (转)SpringMVC学习(六)——SpringMVC高级参数绑定与@RequestMapping注解

    http://blog.csdn.net/yerenyuan_pku/article/details/72511749 高级参数绑定 现在进入SpringMVC高级参数绑定的学习,本文所有案例代码的编 ...

  10. Navicat 复制多条数据