separatorInset和layoutMargins

@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及更高版本)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 162,475评论 4 372
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 68,744评论 2 307
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 112,101评论 0 254
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,732评论 0 221
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 53,141评论 3 297
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 41,049评论 1 226
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 32,188评论 2 320
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,965评论 0 213
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,716评论 1 250
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,867评论 2 254
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,341评论 1 265
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,663评论 3 263
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,376评论 3 244
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,200评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,990评论 0 201
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 36,179评论 2 285
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,979评论 2 279