setNeedsDisplay:

Marks the receiver’s entire bounds rectangle as needing to be redrawn.

drawRect:

This method is called when a view is first displayed or when an event occurs that invalidates a visible part of the view. You should never call this method directly yourself. To invalidate part of your view, and thus cause that portion to be redrawn, call the setNeedsDisplayorsetNeedsDisplayInRect: method instead.

setNeedsLayout:

Invalidates the current layout of the receiver and triggers a layout update during the next update cycle.

layoutIfNeeded

Use this method to force the layout of subviews before drawing.Lays out the subviews immediately.

layoutSubviews:

You should not call this method directly. If you want to force a layout update, call thesetNeedsLayout method instead to do so prior to the next drawing update. If you want to update the layout of your views immediately, call thelayoutIfNeeded method.

总之 你要是排布 子视图 就在layoutSubviews:

         你要是画一些东西 就在drawRect:

setNeedsDisplay 和 setNeedsLayout-b的更多相关文章

  1. UIView的setNeedsDisplay和setNeedsLayout

    1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

  2. setNeedsDisplay,setNeedsLayout

    UIView的setNeedsDisplay和setNeedsLayout方法.首先两个方法都是异步执行的.setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到UIGraph ...

  3. setNeedsDisplay和setNeedsLayout

    1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

  4. UIView常用的一些方法小记之setNeedsDisplay和setNeedsLayout

    1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

  5. 【转】 UIview需要知道的一些事情:setNeedsDisplay、setNeedsLayout

    原文:http://blog.sina.com.cn/s/blog_923fdd9b0101b2b4.html 1.在Mac OS中NSWindow的父类是NSResponder,而在iOS 中UIW ...

  6. iOS UIView常用的一些方法setNeedsDisplay和setNeedsLayout 区别

    1.UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

  7. UIview需要知道的一些事情:setNeedsDisplay、setNeedsLayout

    UIview需要知道的一些事情:setNeedsDisplay.setNeedsLayout 1.在Mac OS中NSWindow的父类是NSResponder,而在i OS 中UIWindow 的父 ...

  8. UIView常用的一些方法setNeedsDisplay和setNeedsLayout

    1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

  9. setNeedsDisplay和setNeedsLayout方法

    参考:https://blog.csdn.net/sunnyboy9/article/details/51458401 . UIView的setNeedsDisplay和setNeedsLayout方 ...

  10. UIView之setNeedsDisplay与drawRect 和 setNeedsLayout与layoutSubViews

    1.UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到  UI ...

随机推荐

  1. 在Eclipse工具里创建maven的web工程,在建立src/main/java包出现The folder is already a source folder.解决

    1. 与创建普通java工程一样,点击右键找到New菜单,在弹出的界面输入maven ---->>点击maven Project------>>点击next 2  进入下一个界 ...

  2. hive 模块

  3. 提升ReSharper和Visual Studio的性能

    转载 作者:赵青青        出处:http://www.cnblogs.com/zhaoqingqing/ 文章目录[点击展开](?)[+]   提升性能 我们不断地确保ReSharper的正常 ...

  4. 融云的Java端实现

    产品中要使用融云实现即时通讯,下面是实现步骤: 1 .注册appkey secret,这个是第一步: 2 .下载融云Java客户端 https://github.com/rongcloud/serve ...

  5. mysql 加入�列,改动列,删除列。

    MySQL 加入�列,改动列,删除列 ALTER TABLE:加入�,改动,删除表的列,约束等表的定义. 查看列:desc 表名; 改动表名:alter table t_book rename to ...

  6. 第三篇:数据仓库系统的实现与使用(含OLAP重点讲解)

    前言 上一篇重点讲解了数据仓库建模,它是数据仓库开发中最核心的部分.然而完整的数据仓库系统还会涉及其他一些组件的开发,其中最主要的是ETL工程,在线分析处理工具(OLAP)和商务智能(BI)应用等. ...

  7. mui.pushToRefresh组件下拉回调函数中this指向问题

    先看一段代码 (function($) { //阻尼系数 var deceleration = mui.os.ios ? 0.003 : 0.0009; $('.mui-scroll-wrapper' ...

  8. jQuery的矿建结构小demo举例

    (function (global) { var document = global.document,//变成局部变量提高搜索的性能 init;// 核心函数 function itcast(sel ...

  9. codevs 1281 Xn数列 (矩阵乘法)

    /* 再来个题练练手 scanf longlong 有bug....... */ #include<cstdio> #include<iostream> #include< ...

  10. 自定义鼠标Cursor转变成图片

    今天无意做到项目遇到一个好玩的事情,就是当我鼠标移到一个链接上面,并不是像正常那样出现一个小手,而是变成一个小十字架, 下面看图当时第一眼看到总感觉哪里不对,噢噢噢噢 这样的 小手没了,居然是一个图片 ...