简体   繁体   English

如何管理口罩?

[英]How to manage masks?

I have issues in my UI understanding masks. 我的界面理解遮罩有问题。 In some cases, the zone I can tap on is smaller than the zone I can see. 在某些情况下,我可以点击的区域小于我可以看到的区域。 If I use 如果我用

myView.clipsToBounds = YES;

I can then see only the zone I can tap on. 然后,我只能看到可以点击的区域。 But I don't understand why it's doing this, neither how to increase my touchable zone. 但是我不明白为什么要这么做,也不清楚如何增加可触摸区域。 I've tried with some 我尝试过一些

myView.autoresizingMask = UIViewAutoresizingFlexibleSometing

but as I don't know how it works, the results isn't satisfying. 但由于我不知道它是如何工作的,因此效果令人不满意。

Can anyone help me understand how to manage these masks ? 谁能帮助我了解如何管理这些口罩?

Thank you ! 谢谢 !

those are 2 different things. 那是两件事。

在此处输入图片说明

clipsToBounds means if you have a view2 in view1, by default you can see like above clipsToBounds表示如果view1中有view2,默认情况下,您可以看到如上

but if you set view1.clipsToBounds = YES , all the presentation in view1 will be clipped in the region of the view1's bound like below 但是,如果您设置view1.clipsToBounds = YES ,则view1中的所有演示文稿都会被裁剪到view1的边界区域中,如下所示

Document says : Setting this value to YES causes subviews to be clipped to the bounds of the receiver. 文档说:将此值设置为YES会导致子视图被裁剪到接收器的边界。 If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. 如果设置为NO,则不会裁剪其帧超出接收者可见范围的子视图。 The default value is NO. 默认值为“否”。

在此处输入图片说明

autoresizingMask means the way to resize the view's frame when the superView's frame changed autoresizingMask表示当superView的框架更改时调整视图框架大小的方法

Document says : When a view's bounds change, that view automatically resizes its subviews according to each subview's autoresizing mask. 文档说:当视图的边界改变时,该视图将根据每个子视图的自动调整大小蒙版自动调整其子视图的大小。 You specify the value of this mask by combining the constants described in UIViewAutoresizing using the C bitwise OR operator. 您可以通过使用C逐位OR运算符组合UIViewAutoresizing中描述的常量来指定此掩码的值。 Combining these constants lets you specify which dimensions of the view should grow or shrink relative to the superview. 结合使用这些常量,您可以指定视图的哪些尺寸应相对于父视图增大或缩小。 The default value of this property is UIViewAutoresizingNone, which indicates that the view should not be resized at all. 此属性的默认值为UIViewAutoresizingNone,它指示不应完全调整视图的大小。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM