How is the relation between UIView#39;s clipsToBounds and CALayer#39;s masksToBounds?(UIView的clipsToBounds和CALayer的masksToBounds是什么关系?)
问题描述
一个 UIView
有一个 CALayer
.这很确定.但两者似乎都提供了相同的含义.
A UIView
has a CALayer
. That's pretty sure. But both seem to provide something that means the same thing.
如果我设置 clipsToBounds=YES
,这是否也会设置图层的 masksToBounds=YES
?为什么不同的名字?有谁知道吗?
If I'd set clipsToBounds=YES
, would this also set the layer's masksToBounds=YES
? Why different names? Anyone knows?
推荐答案
它们是不同的名称,因为 UIView
和 CALayer
是不同的,并且有不同的术语与之关联,但是它们在功能上是等效的.如果你反汇编 clipsToBounds
你会看到它只是调用 masksToBounds
(从模拟器框架反汇编,所以 x86):
They are different names because UIView
and CALayer
are different and have different terminology associated with them, but they are functionally equivalent. If you disassemble clipsToBounds
you will see it just calls masksToBounds
(disassembly from the simulator framework, so x86):
-(BOOL)[UIView(Rendering) clipsToBounds]
+0 3091938a 55 pushl %ebp
+1 3091938b 89e5 movl %esp,%ebp
+3 3091938d e800000000 calll 0x30919392
+8 30919392 59 popl %ecx
+9 30919393 8b4508 movl 0x08(%ebp),%eax
+12 30919396 8b5004 movl 0x04(%eax),%edx (CALayer)_layer
+15 30919399 8b8186cb1301 movl 0x0113cb86(%ecx),%eax masksToBounds
+21 3091939f 89450c movl %eax,0x0c(%ebp)
+24 309193a2 895508 movl %edx,0x08(%ebp)
+27 309193a5 c9 leave
+28 309193a6 e92e211801 jmpl 0x31a9b4d9
这篇关于UIView的clipsToBounds和CALayer的masksToBounds是什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIView的clipsToBounds和CALayer的masksToBounds是什么关系?


- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 拆分 Drawable 2022-01-01