美文网首页
separatorInset和layoutMargins

separatorInset和layoutMargins

作者: 天空的羁绊 | 来源:发表于2017-11-27 23:47 被阅读33次

    @property(nonatomic) UIEdgeInsets separatorInset;
    Description
    Specifies the default inset of cell separators.
    In iOS 7 and later, cell separators do not extend all the way to the edge of the table view. This property sets the default inset for all cells in the table, much as rowHeight sets the default height for cells. It is also used for managing the “extra” separators drawn at the bottom of plain style tables.
    For example, to specify a table view where the default left separator inset is 3 points and the default right separator inset is 11, you would write:
    Listing 1
    tableView.separatorInset = UIEdgeInsetsMake(0, 3, 0, 11);
    If every cell in a table contains an image view of the same size, by default iOS vertically aligns the leading edge of all separators. In a table that mixes text-only cells with cells that contain image views, you can use the separatorInset property to ensure that the separators are vertically aligned.
    In a right-to-left user interface, an inset that you set using the separatorInset property automatically flips its left and right measurements.
    Availability iOS (7.0 and later), tvOS (7.0 and later)

    描述:
    1.指定cell分割符的默认嵌入。
    2.在iOS7和更高版本中,cell分割符不会一直延伸到tableView的边缘。
    这个属性为所有在table上的cell设置默认的嵌入,就像rowHeigth设置cell的默认高度一样。它还作用于画在plain style 的table底部的“格外“的分割符。
    3.例如:指定table view默认左侧分割符插入3点,右侧默认插入11点,可以这样写:
    列举 1
    tableView.separatorInset = UIEdgeInsetsMake(0, 3, 0, 11);
    4.如果table上的每一个cell都包含同样大小的image view,则默认情况下,iOS会垂直对齐所有分割符的前缘。在将纯文本的cell和包含image views的cell混合在一起的table中,可以使用separatorInset属性来确保分割符垂直对齐。
    5.在从右到左的用户界面中,使用separatorInset属性设置的嵌入,会自动反转其左侧和右侧的尺寸。
    6.可用性iOS(7.0及更高版本),tvOS(7.0及更高版本)

    @property(nonatomic) UIEdgeInsets layoutMargins;
    Description
    The default spacing to use when laying out content in the view.
    Use this property to specify the desired amount of space (measured in points) between the edge of the view and any subviews. Auto layout uses your margins as a cue for placing content. For example, if you specify a set of horizontal constraints using the format string “|-[subview]-|”, the left and right edges of the subview are inset from the edge of the superview by the corresponding layout margins. When the edge of your view is close to the edge of the superview and the preservesSuperviewLayoutMargins property is YES, the actual layout margins may be increased to prevent content from overlapping the superview’s margins.
    The default margins are eight points on each side.
    If the view is a view controller’s root view, the system sets and manages the margins. The top and bottom margins are set to zero points. The side margins vary depending on the current size class, but can be either 16 or 20 points. You cannot change these margins.
    Availability iOS (8.0 and later), tvOS (8.0 and later)

    1.在布局视图的内容时使用的默认间距。
    2.使用此属性来指定视图边缘和任何子视图之间所需的空间量(以点为单位)。自动布局使用你的边距作为放置内容的提示。例如,如果你使用格式字符串“|-[subview]-|”来指定一组水平约束,则子视图的左右边缘将通过相应布局边距从父视图的边缘插入。当视图的边缘靠近父视图的边缘,并且preservesSuperviewLayoutMargins(保留父视图布局边距)属性设置为YES,则可以增加实际布局边距以防止内容与父视图的边距重叠。
    3.每个边的默认边距为8个点。
    4.如果视图是视图控制器的根视图,则系统会设置并且管理边距。顶部和底部边距被设置为0个点。侧边距根据当前尺寸等级会产生变化,但可以是16或20个点。并且你无法更改这些尺寸。
    5.可用性iOS(8.0及更高版本),tvOS(8.0及更高版本)

    相关文章

      网友评论

          本文标题:separatorInset和layoutMargins

          本文链接:https://www.haomeiwen.com/subject/zfujbxtx.html