如何知道视图中选取器的确切大小?

发布于 2025-01-16 02:21:16 字数 51 浏览 7 评论 0 原文

要准确了解视图的架构以及如何组合它,了解父视图中选取器的大小将很有用。这是可以预见的吗?

To precisely know the View's architecture, and how to compose it, it will be useful to know what size will get the Picker in the parent View. Is this predictable ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十年九夏 2025-01-23 02:21:16

我不认为我真的理解这个问题,但你可以给出像这样的选择器框架。

       VStack {
        Picker("Colors", selection: $selectedColor) {
            ForEach(colors, id: \.self) {
                Text($0)
            }
        }
        .frame(width: 10)
        .clipped()

或者你可以使用 GeometryReader

I don't think I really understand the question, but you can give the Picker frame like.

       VStack {
        Picker("Colors", selection: $selectedColor) {
            ForEach(colors, id: \.self) {
                Text($0)
            }
        }
        .frame(width: 10)
        .clipped()

Or you can use GeometryReader

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文