setNeedsDisplay 和 setNeedsLayout-b
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的更多相关文章
- UIView的setNeedsDisplay和setNeedsLayout
1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
- setNeedsDisplay,setNeedsLayout
UIView的setNeedsDisplay和setNeedsLayout方法.首先两个方法都是异步执行的.setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到UIGraph ...
- setNeedsDisplay和setNeedsLayout
1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
- UIView常用的一些方法小记之setNeedsDisplay和setNeedsLayout
1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
- 【转】 UIview需要知道的一些事情:setNeedsDisplay、setNeedsLayout
原文:http://blog.sina.com.cn/s/blog_923fdd9b0101b2b4.html 1.在Mac OS中NSWindow的父类是NSResponder,而在iOS 中UIW ...
- iOS UIView常用的一些方法setNeedsDisplay和setNeedsLayout 区别
1.UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
- UIview需要知道的一些事情:setNeedsDisplay、setNeedsLayout
UIview需要知道的一些事情:setNeedsDisplay.setNeedsLayout 1.在Mac OS中NSWindow的父类是NSResponder,而在i OS 中UIWindow 的父 ...
- UIView常用的一些方法setNeedsDisplay和setNeedsLayout
1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
- setNeedsDisplay和setNeedsLayout方法
参考:https://blog.csdn.net/sunnyboy9/article/details/51458401 . UIView的setNeedsDisplay和setNeedsLayout方 ...
- UIView之setNeedsDisplay与drawRect 和 setNeedsLayout与layoutSubViews
1.UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的.而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UI ...
随机推荐
- windows下python安装paramiko
Python中使用SSH需要用到OpenSSH,而OpenSSH依赖于paramiko模块,而paramiko模块又依赖于pycrypto模块,因此要在Python中使用SSH,则需要先安装模块顺序是 ...
- Linux 数学运算
let 命令 a= b= let c=a+B echo $c let a++ let b++ echo $a $b []方法 a= b= echo $[a+b] echo $[$a+$b] (()) ...
- Web —— tomcat 问题解决
1.在Eclipse 上部署到Tomcat,使用mybatis 访问数据库,junit测试访问正常,Tomcat运行时报错: java.lang.NoClassDefFoundError: org/a ...
- Struts2 入门(新手必看)
船舶停靠在港湾是很安全的,但这不是造船的目的 Struts 2及其优势 Struts 2是一个MVC框架,以WebWork框架的设计思想为核心,吸收了Struts 1的部分优点 Struts ...
- SVN server的搭建
当做大的项目是,svn是代码管理的好工具,假设是用自己的server,那么须要搭建SVNserver. Subversion是一款很优秀的svnserver工具,笔者採用VisualSVN serve ...
- [PWA] 8.Unobtrusive update: Delete old cache and only keep one, hard refresh to let new SW to take control
So once you modify the code, service worker will auto create a new one and it won't take control ove ...
- RSA体系 c++/java相互进行加签验签--转
在web开发中,采用RSA公钥密钥体系自制ukey,文件证书登陆时,普遍的做法为:在浏览器端采用c++ activex控件,使用 c++的第三库openssl进行RAS加签操作,在服务器端采用java ...
- struts2学生信息管理系统篇章④
把util包中的代码做了一下注释,分享一下 DateUtil 类 package com.java1234.util; import java.text.SimpleDateFormat; impor ...
- node.js动态调试
supervisor node ./bin/www npm start 不会动态运行和调试程序,相当于动态部署
- (转)PHP自定义遍历目录下所有文件dir(),readdir()函数
方法一:使用dir()遍历目录 dir()函数,成功时返回Directory类实例 PHP dir() 语法格式为: dir(directory);//directory为需要显示文件名的目录名称,可 ...