- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
1> 我的 tableview 中有 UITableViewCell
和 UITableViewCell subclass cell
。在 UITableViewCell 子类单元格
上设置 SeparatorInset
不起作用?但是如果我在 UITableViewCell
上设置它就可以正常工作。
2> 关于 SeparatorInset
的 Apple 文档说:
You can use this property to add space between the current cell’s contents and the left and right edges of the table. Positive inset values move the cell content and cell separator inward and away from the table edges. Negative values are treated as if the inset is set to 0.
Only the left and right inset values are respected; the top and bottom inset values are ignored. The value assigned to this property takes precedence over any default separator insets set on the table view.
一个。如果我在 UITableViewCell
上设置 [cell setSeparatorInset:UIEdgeInsetsMake(0, 100, 0, 0)];
它会将内容向右推
但是在 UITableViewCell
上设置 [cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 100)];
只会将分隔符推向左侧而不是内容,为什么?
最佳答案
1)
在 UITableViewCell
中,您有无法直接编辑的 subview (标题、附件 View 等)。 separatorInset
使您能够调整这些 subview 的位置(换句话说,separatorInset
在这些 subview 的位置计算期间被考虑在内)。
在自定义 UITableViewCell
子类中,您定位自己的 subview ,因此除非您在计算它们的位置时特别考虑 separatorInset
,否则它没有任何效果。
2)
separatorInset
不会将内容“推”到左/右,而是将(虚拟)插图添加到它们所在的容器中。所以如果例如您只有标题不会拉伸(stretch)到单元格的全宽 (-100) 添加右插图后您不会看到任何差异。
关于ios - 需要有关 UITableViewCell SeparatorInset 的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29227372/
1> 我的 tableview 中有 UITableViewCell 和 UITableViewCell subclass cell。在 UITableViewCell 子类单元格 上设置 Separ
我已经实现了类似于日历应用程序实现它的方式的内联日期选择器,您可以在其中点击 UITableViewCell 并展开它下面包含 UIDatePicker< 的下一个单元格。现在我有一个日期选择器作为一
这是我在 iOS 11 之前用于隐藏单个 UITableViewCell 分隔符的代码: - (void)tableView:(UITableView *)tableView willDisplayC
如果我设置一个红色 separatorColor在 iOS 7 中的表 View 上并设置 separatorInset至 UIEdgeInsetsZero或任何其他自定义插入值,所有附加或“额外”行
我在 Xcode 6 GM 上的 iPhone 6 Simulator (iOS 8) 的 UITableView 上发现了一个奇怪的空白区域。我试图从 Storyboard 和代码中设置 Separ
在 iPhone 6s 上,当我将单元格分隔线左插入设置为 14 时,显示为 15,我认为这是因为它默认设置了 preservesSuperviewLayoutMargins = true。 但来自苹
我是一名优秀的程序员,十分优秀!