How to mask a UIStackView in Swift?

孤者浪人 提交于 2020-07-20 03:41:50

问题


I understand that UIStackViews are not rendered the same way the rest of view components are and thus they cannot be masked. Nonetheless I am sure there are work arounds.

Is there any way to mask a UIStackView? Specifically a stack view that has other UIStackViews as subviews.


回答1:


You can't, I believe. Although it's a subclass of UIView, you still can't even set a backgroundColor to it. Apple says:

The UIStackView is a nonrendering subclass of UIView; that is, it does not provide any user interface of its own. Instead, it just manages the position and size of its arranged views. As a result, some properties (like backgroundColor) have no effect on the stack view. Similarly, you cannot override layerClass, draw(:), or draw(:in:).

https://developer.apple.com/documentation/uikit/uistackview



来源:https://stackoverflow.com/questions/62907180/how-to-mask-a-uistackview-in-swift

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!