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. cobbler客户端重装系统

    已有操作系统的主机通过koan从Cobbler服务器重装系统 1,安装epel rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel- ...

  2. 开发Mhealth(即:Mobile Health 移动医疗)应用必知的10个掘金点

    近 日,著名移动技术咨询公司Research2Guidance发布了最新版的<移动医疗应用开发者经济>报告.在过去的两年半里,iOS和Android 两大主流移动平台上的移动医疗应用(以下 ...

  3. raknet unity3d

    Raknet是一高性能的跨平台的网络库. 他主要基于UDP实现,性能非常好,能够做server. 鉴于unity3d较差的网络支持. 本人成功实现了raknet c# for unity3d的使用,s ...

  4. AIDL跨进程通信

    Android跨进程通信会用到AIDL,当然跨进程通信不一定要用AIDL,像广播也是可以的,当然这里用到AIDL相对比较安全一些: AIDL允许传递基本数据类型(Java 的原生类型如int/long ...

  5. Pgsql 里面 COALESCE的用法

    有这种要求,更新自己本身的字段的某个值进行加或者减, 常规方法: UPDATE tbl_kintai_print_his SET print_time = now(), print_emp_cd = ...

  6. 二维码生成Demo

    在C#中直接引用ThoughtWorks.QRCode.dll 类, 下载 dll 类 http://file.111cn.net/download/2013/06/29/20120516165420 ...

  7. HTML5 File 对象

    实例说明1: <div class="container"> <input type="file" id="file" m ...

  8. 使用Instant Client配置PL/SQL Developer

    之前使用PL/SQL Developer都是直接在本机安装完整版的Oracle Database,一是省事,二是可以在本机做一些demo测试:最近换了台电脑,感觉Instant Client更简单一些 ...

  9. Pythonchallenge一起来闯关(二)

    前情提要:Pythonchallenge一起来闯关(一) 这一篇来闯关10-15.感觉这几关比先前的难了不少,有的题目完全没思路. 10. 页面源码中的链接点击后有a = [1, 11, 21, 12 ...

  10. 当OOP语言RAII特性发展到functional形式的极致

    本文主要站在C++程序员的思维角度思量. functional之路 lambda表达式 lambda表达式,是一段代码片段.函数实现体中出现的可重用的代码块. 在C++之前,C语言最小可复用流程模块, ...