创建: 2018/04/21

完成: 2018/04/25

更新: 2018/09/24 补充UIActivityIndicatorView的显示和隐藏方法

UIButton
 设定项目
 项目名  方法名/属性名  
 Title  setTitle  设置按钮上的标题
 Text Color  setTitleColor  设置标题颜色
 Image  setImage  设置取代标题的图片
 Background (Image)  setBackgroundImage  设置背景图片

Alignment(Horizontal)

 contentHorizontalAlignment  设置标题的水平位置
 Alignment(Vertical)  contentVerticalAlignment  设置标题的竖直位置
 Enabled  isEnabled  是否可点击
 Hidden  isHidden  是否隐藏
 Alpha  alpha  不透明度
 Background  backgroundColor  背景颜色
 Action  addTarget  指定点击后的处理
     
 action 

三要素

 事件(Event)  操作的种类
 对象(UI自身, 方法的sender)  被操作的对象
 受体(方法)  进行处理的函数
 代码创建  不用
   
   
   
   
   
UILabel
 设定项目
 项目名  属性/方法  
 Text  text  UILabel的文字
 Color  textColor  文字颜色
 Font  font  文字的字体
 Lines  numberOfLines

行数

设为0则自动判断

 Alignment  textAlignment

文字的位置

(靠左, 靠右, 居中)

 Line Break  lineBreakMode

改行方式

被省略部分表示为   ...

 Truncate Tail  省略末尾
 Truncate Middle  省略中间
 Truncate Head  省略开头
 Clip  直接不表示 
 Character Wrap  
   
   
 Hidden  isHidden  是否隐藏
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 storybord上的一些操作  ● 换行: option+return
   
   
   
   
   
   
UITextField
   用来输入一行文字
 设定项目

更高级的用法在TextKit

 项目名  属性/方法  
 Text  text  输入的文字
 Color  textColor  文字颜色
 Font  font  文字字体
 Alignment  textAlignment

文字位置

 Editable  isEditable

是否可以编辑

 Selectable    是否可选
 Data Detectors  dataDectectorTypes  侦测特定内容生成链接
 Text Input Traits    
 Indicators  indicatorStyle  滚动条的样式
 Scrolling Enabled  isScrollEnabled  是否可以滚动
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Tint  tintColor  所有子View的继承色
 Hidden  isHidden  是否隐藏
 Text Input Trait

输入时候详细设定键盘的动作

 项目名  属性/方法  
 Content Type  textContentType

内容种类

设定后输入时会自动补全

 Capitalization  autocapitalizationType  是否首字母大写
 Correction  autocorrectionType  是否自动修正输入错误
 Smart Dashes  smartDashesType

是否自动转换dash

https://zh.wikipedia.org/wiki/%E8%BF%9E%E6%8E%A5%E5%8F%B7

 Smart Insert  smartInsertDeleteType  粘贴和删除时是否自动处理空格
 Smart Quotes  smratQuotesType  是否自动转换
 Spell Check  spellCheckingType  是否检查拼写错误
 Keyboard Type  keyboardType  键盘种类
 Keyboard Look  keyboardAppearance  键盘style
 Return Key  returnKeyType  return键的种类
 Auto Enable Return Key  enablesReturnKeyAutomatically  是否自动切换return键的有效/无效
 Secure Text Entry  isSecureTextEntry  是否遮盖输入内容(类似password)
     
     
 focus操作

目前聚焦的叫做 First Responder

 获取聚焦

对象.becomeFirstResponder()

 取消聚焦

对象.resignFirstResponder()

关闭键盘可以理解为算是取消聚焦

 事件操作  可以直接连接action, 也可以用delegate
   
   
   
UITextView
   输入多行的文本
 设定项目

 项目名  属性/方法  
 Text  text  输入的文字
 Color  textColor  文字颜色
 Font  font  文字字体
 Alignment  textAlignment

文字位置

 Border Style  borderStyle  边线的种类
 Clear Button  clearButtonMode  清除内容的按钮的表示方法
 Text Input Traits    
 Enabled  isEnabled  此UI是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Tint  tintColor  所有子View的继承色
 Hidden  isHidden  是否隐藏
 Background(Image)  backgroundImage  背景图
 Disabled(Image)  disabledBackground  无效时的背景图
     
   
   
   
   
   
   
UISegmentedController
   从多个值里选一个
 设定项目
 项目名  属性/方法  
 Segments  不存在  选项的个数
 SegmentTitle  setTiele  选项的标题
 Segment Image  setImage  选项的图片
 Segment Enabled  setEnabled  选项是否有效(可选)
 Segment Selected  selectedSegmentIndex

是否被选中

(选中的index)

 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Tint  tintColor  子类继承色
 Hidden  isHidden  是否隐藏
     
   
   
   
   
   
   
UIStepper
   以固定增幅增减数值
 设定项目
 项目名  属性/方法  
 Value  value  现在的值
 Minimun  minimumValue  最小值
 Maximum  maximumValue  最大值
 Step  stepValue  一次变化的值
 Autorepeat  autorepeat  长按是否自动变化
 Continuous  isContinuous

长按是否持续发出事件(消息)

设为false则长按结束前不会改变值

    长按结束后一次性变到新值

 Wrap  wraps  超过上下限是否回到另一端开头
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Tint  tintColor  文字与边线的颜色
 Hidden  isHidden  是否隐藏
     
     
     
   
   
   
   
   
   
UISwitch
   
 设定项目 
 项目名  属性/方法  
 State  isOn  是否On
 On Tint  onTintColor  On时候的背景色与边线颜色
 Thumb Tint  thumbTintColor  内部圆和OFF时的边线颜色
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景颜色
 Hidden  isHidden  是否不表示
     
     
   
   
   
   
   
   
UISlide
   滚动条输入数值 
 设定项目
 项目名  属性/方法  
 Value  value  现在的值
 Minimum  minimumValue  最小值
 Maximum  maxmumValue  最大值
 Min Image  minimunValueImage  左侧表示的图象
 Max Image  maxmumValueImage  右侧表示的图象
 Min Track  minimunTrackTintColor  左侧的线的颜色
 Max Track  maxmumTrackTintColor  右侧的线的颜色
 Thumb Tint  thumbTintColor  圆的颜色
 Continuous Updates  isContinuous  滑动时是否发出事件
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
   
   
   
   
   
   
UIActivityIndicatorView
   读取中等
 设定项目
 项目名  属性/方法  
 Style  activityIndicatorViewStyle  指示器的样式
 Color  color  指示器的颜色
 Animating  isAnimating  是否展示动画
 Hides When Stopped  hidesWhenStopped  停止动画后是否隐藏
 Enabled  isEnabled  是有有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
     
 方法 

显示

indicator.startAnimating()
 隐藏
indicator.stopAnimating()
   
   
   
   
   
UIProgressView
   进度条
 设定项目
 项目名  属性/方法  
 Style  progressViewStyle  进度条样式
 Progress  progress

进度

Float

0.0 ~ 1.0

 Progress Tint  progressTintColor  左侧颜色
 Track Tint  trackTintColor  右侧颜色
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Hidden  isHidden  是否隐藏
     
   
   
   
   
   
   
UIPickerView
   多选项选择
 设定项目
 项目名  属性/方法  
 Enabled  isEnabled  是否可用
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
     
   
   
   
   
   
   
  UIDatePicker
   选择日期
 设定项目
 项目名  属性/方法  
 Mode  datePickerMode  选择器的样式
 Locale  locale  位置
 Interval  minuteInterval  分钟间隔
 Date  date  选中的日期
 Minimum Date  minimumDate  最小日期
 Maximum Date  maxmumDate  最大日期
 Timer  countDownDuration  倒计时
 Enabled  isEnabled  是有有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
     
 Date操作

DateFormatter

   
   
   
   
   
   
   
UIBarButtonItem
   向工具条(tool bar)或者导航条(navigation bar)上配置的按钮
 设定项目
 项目名  属性/方法  
 Style  style  item的样式
 System Item  初始化的参数(init)  系统item的种类 
 Title  title  标题
 image  image  图象
 Landscape Image  landscapeImagePhone  横向画面时使用的图片
 Enabled  isEnabled  是有有效
     
   // TODO: 增加实例
   
   
   
   
   
UIPageControl
   
 设定项目
 项目名  属性/方法  
 Pages  numberOfPages  页数
 Defers Page Display  defersCurrentPageDisplay

设定为true则

直到呼出updateCurrentPageDisplay

不会换页

 Tint Color  pageIndicatorTintColor  未选择的页的颜色
 Current Page  currentPageIndicatorTintColor  当前选择页面的颜色
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
     
   
   
   
   
   
   
UIRefreshControl
   // TODO: 增加实例
   
   
   
   
   
   
   
UIWKWebView
 

WebView就用这个

● iOS8以后不推荐用UIWebView

 设定项目
 项目名  属性/方法  
 User Agent  customUserAgent  用户代理
 App Name  configuration.applicationNameForUserAgent  用户代理内的app名
 Back/Forward Gestures  allowsBackForwardNavigartionGestures  是否允许滑动前进后退
 Selection  configuration.selectionGranularity  选择模式
 AirPlay  configuration.allowsAirPlayForMediaPlayback  是否允许Aitplay
 Inline Playback  configuration.allowsInlineMediaPlayback

是否允许HTML5的video

行内播放

false则全屏播放

 Picture-in-Picture  configuration.allowsPictureinPictureMediaPlayback

是否允许HTML5的video

Picture-in-Picture播放

 Interaction  configuration.mediaTypesRequiringUserActionForPlayback  播放media是否需要用户操作触发
 Data Detectors  configuration.dataDetectorTypes  探测数据并放置链接
 JavaScript  configuration.preferences.JavaScriptEnabled  是有有效化JavaScript
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
   
   
   
   
   
   
UIWebView
 

尽量不用, 需要webView但WKWebView太复杂的时候用SFSafariViewController

 设定项目
 项目名  属性/方法  
 Scales Page To Fit  scalesPageToFit  调整内容大小填入UIWebView
 Data Detectors  dataDetectorTypes  探测数据并放置链接
 Allows Inline Playback  allowsInlineMediaPlayback

是否允许HTML5 视频

inline或全屏播放

 Playback Requires User Action  mediaPlaybackRequiresUserAction  播放是否需要用户触发
 Keyboard Display Requires User Action  keyboardDisplayRequiresUserAction  表示键盘是否需要用户触发
 Enabled  isEnabled  是否有效
 Alpha  alpha  不透明度
 Background  backgroundColor  背景色
 Hidden  isHidden  是否隐藏
   
   
   
   
   
   

iOS UI控件的更多相关文章

  1. iOS UI控件继承关系图

    闲来无事,把UI控件的继承关系图整理下来,供自己和大家使用.

  2. ios UI控件的简单整理

    把该文件拷贝到.m文件中就能够方便的查找 /** 匿名类目:能够声明方法和变量,属性为private(不同意在外部调用,且不能被继承 */ /** 发送数据的托付方,接收数据的时代理发(即代理的反向传 ...

  3. iOS UI控件总结(全)

    1.UIButton UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake ...

  4. iOS UI控件之间的关系图

  5. IOS学习资源收集--开发UI控件相关

    收集的一些本人了解过的iOS开发UI控件相关的代码资源(本文持续补充更新) 内容大纲: 1.本人在github上也上传了我分装好的一些可重复利用的UI控件 2.计时相关的自定义UILabel控件 正文 ...

  6. iOS 使用UI控件的外观协议UIAppearance进行设置默认UI控件样式

    在iOS开发中,经常会对UINavigationBar的样式进行全局样式.采用的设置方式有两种: 第一种,采用方式如下: [UINavigationBar appearance] 这种是对一类对象的默 ...

  7. 79.iOS 设备的UI规范和iOS各控件默认高度

    iOS设备的UI 规范 iPhone界面尺寸 iPhone图标尺寸 iPad的设计尺寸 iPad图标尺寸 iPhone设备尺寸分辨率比例 iPhone各设备 launch image iOS 各种控件 ...

  8. iOS基础UI控件介绍-Swift版

    iOS基础UI控件总结 iOS基础控件包括以下几类: 1.继承自NSObject:(暂列为控件) UIColor //颜色 UIImage //图像 2.继承自UIView: 只能相应手势UIGest ...

  9. iOS 中UI控件的各种对齐方式总结

    1.textAligment : 文字的水平方向的对齐方式 取值 NSTextAlignmentLeft      = 0,    // 左对齐 NSTextAlignmentCenter    = ...

随机推荐

  1. 【转】How to Change File Ownership & Groups in Linux

    有关linux下 文件权限的问题,一直不是很清楚.(参考菜鸟教程: http://www.runoob.com/linux/linux-file-attr-permission.html) 像上面这样 ...

  2. C# 实体类序列化与反序列化一 (XmlSerializer)

    /// <summary> /// 实体类序列化的反序列化的类 /// </summary> /// <typeparam name="T">& ...

  3. 跟阿根一起学Java Web开发一:开发环境搭建及JSPGen基础配置

    JSPGenSDF软件开发框架(于2014年5月5号公布4.0版).简称JSPGen,专用Java Web方面平台式软件开发,整个框架也能够说是前台与后台的一个粘合剂,如今对JSPGenSDF进行开发 ...

  4. Ghost本地安装highlight.js使代码高亮

    对于程序猿写博客来说,这代码高亮是起码的要求.可是Ghost本身没有支持高亮代码. 可是能够通过扩展来实现,它就是highlight.js--附官方站点,看了下首页介绍,真的非常强大,如今说说怎么进行 ...

  5. Android源代码解析之(三)--&gt;异步任务AsyncTask

    转载请标明出处:一片枫叶的专栏 上一篇文章中我们解说了android中的异步消息机制. 主要解说了Handler对象的使用方式.消息的发送流程等.android的异步消息机制是android中多任务处 ...

  6. ajax请求后台交互json示例

    ajax请求,首先需要服务器(首先你需要node) npm i -g http-server 其次,进入当前目录(默认服务器端口8080) http-server 点击进入:localhost:808 ...

  7. vue - 前置工作 - 安装vsCode以及插件

    开发环境:Win7 x64 开发工具:vsCOde 开发工具vsCode插件配置:Vetur.ivue.Vue 2 Snippets Vetur:强力推荐的一款插件,为什么呢? 格式化代码.高亮.代码 ...

  8. android项目笔记(一)

    1.getInstance:单例模式创建类的实例,getInstance在单例模式(保证一个类仅有一个实例,并提供一个访问它的全局访问点)的类中常见,用来生成唯一的实例,getInstance往往是s ...

  9. IO模型:同步、异步、阻塞、非阻塞

    前言: 在Linux的网络编程中,同步IO(synchronous IO).异步IO(asynchronous IO).阻塞IO(blocking IO).非阻塞IO(non-blocking IO) ...

  10. Machine Learning—Online Learning

    印象笔记同步分享:Machine Learning-Online Learning