gpt4 book ai didi

ios - 如何在 Xcode 7 中使用对象库的 Stack View

转载 作者:搜寻专家 更新时间:2023-10-30 21:59:33 25 4
gpt4 key购买 nike

我最近安装了 Xcode 7 beta 并发现了一些东西 新的对象库中的

水平堆栈 View 和垂直堆栈 View

When i put some controls inside it, stackview seems to be resizable according to the control size. When i present more controls the stack seems to be adjust automatically as of the stack view. Either adjusting horizontally or vertically?

它是否源自其他一些移动平台

最佳答案

使用 UIStackView 的一个主要优势是它使用自动布局来定位和调整其排列的 UIViews。因此,您无需担心在 UIStackView 中定位 UIView。对于水平堆栈,这意味着第一个排列的 View 的前缘固定到堆栈的前缘,最后一个排列的 View 的后缘固定到堆栈的后缘。您可以尝试将两个或更多控件插入水平堆栈 View ,了解它们如何水平对齐。

The UIStackView class provides a streamlined interface for laying out a collection of views in either a column or a row. Stack views let you leverage the power of Auto Layout, creating user interfaces that can dynamically adapt to the device’s orientation, screen size, and any changes in the available space. The stack view manages the layout of all the views in its arrangedSubviews property. These views are arranged along the stack view’s axis, based on their order in the arrangedSubviews array. The exact layout varies depending on the stack view’s axis, distribution, alignment, spacing, and other properties.

如何使用

这是来自 raywenderlich 网站的详细教程:

http://www.raywenderlich.com/114552/uistackview-tutorial-introducing-stack-views

更多请看 https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIStackView_Class_Reference/index.html

关于ios - 如何在 Xcode 7 中使用对象库的 Stack View,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779724/

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