gpt4 book ai didi

ios - UIStackView 图层属性

转载 作者:行者123 更新时间:2023-12-01 15:44:39 25 4
gpt4 key购买 nike

每个 View 都有一个进行渲染的层。令我困惑的是,您无法为堆栈 View 设置圆角半径或边框,但当您隐藏其中一个已排列的 subview 时,其余 subview 会填满堆栈 View 。

此外,Apple 文档说堆栈 View 仅管理其排列的 subview 。

但是,堆栈 View 如何调整其 subview 的大小?隐藏排列的 subview 时,堆栈 View 的层是否会调整大小?如果不是,那么 layer 属性在堆栈 View 中的用途是什么?

最佳答案

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:).

考虑将堆栈 View 放置在另一个 UIView 中,并为该 View 指定圆角半径或边框。
Apple Doc

关于ios - UIStackView 图层属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52064703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com