Overlapping Views in UIStackView

后端 未结 7 1682
时光说笑
时光说笑 2020-12-14 17:24

I have an horizontal stack view that I added arranged sub views to it (7 cells). Each one of the cells in the stack has a circular badge that exceeds the view boundaries (ne

7条回答
  •  眼角桃花
    2020-12-14 17:44

    The documentation for the UIStackView class tells that:

    The order of the subviews array defines the Z-order of the subviews. If the views overlap, subviews with a lower index appear behind subviews with a higher index.

    which is exactly what I experienced in the question. To over come my specific case I did the trick of changing the semantic of the view to be RTL as can bee seen here:

    This is not covering the a generic case because a device may have been set a RTL language in its global settings. For the generic case I guess I will need to check the interface semantic and force an opposite direction to my stack view.

    P.S. It's kind of hack so any ideas about how to reorder the Z-order of subviews in a different way will be most welcome!

提交回复
热议问题