xcode 故事板:什么是“索引行限制”字段?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12065020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Storyboards: what is the "Index Row Limit" field?
提问by Kent
In Storyboards, TableViews have an attribute field named "Index Row Limit". The default is 2. I cannot find any information on what this is. A Google searchreturns a single page of results and half of the results are non-English. Does anyone know what this field is for?
在 Storyboards 中,TableViews 有一个名为“Index Row Limit”的属性字段。默认值为 2。我找不到有关这是什么的任何信息。一个谷歌搜索返回结果的单页和结果的一半为非英语。有谁知道这个字段是做什么用的?
回答by BJ Homer
It's related to the sectionIndexMinimumDisplayRowCount
property on UITableView
. Basically, if you have less than that many rows in the table, any section index will be hidden. (The section index is the bar on the right hand side of the table that usually has the letters A-Z, which lets you quickly jump through the list.)
它与 上的sectionIndexMinimumDisplayRowCount
财产有关UITableView
。基本上,如果表中的行数少于那么多,则任何部分索引都将被隐藏。(部分索引是表格右侧的栏,通常带有字母 AZ,可让您快速跳转列表。)
Update:
I've verified that setting the "Index Row Limit" in the .xib or .storyboard does indeed change a value in the underlying XML titled sectionIndexMinimumDisplayRowCount
, so it's clear that's what this property is supposed to be related to. However, it also appears that there's a bug in UITableView (at least as of iOS 5.1), such that the setting in Interface Builder isn't actually being properly set on the object when it is unarchived at runtime. Time to file a radar!
更新:我已经验证在 .xib 或 .storyboard 中设置“索引行限制”确实会更改标题为 的基础 XML 中的值sectionIndexMinimumDisplayRowCount
,因此很明显这就是该属性应该与之相关的内容。但是,UITableView 中似乎也存在一个错误(至少从 iOS 5.1 开始),因此在运行时取消归档对象时,Interface Builder 中的设置实际上并未在对象上正确设置。是时候提交雷达了!
回答by Tibin Thomas
This value is used to decide when to show the special index list on the right side of table view.If the row count(total number of rows) of table view is greater than or equal to this number the index list on right side of table view is shown else not shown.
该值用于决定何时在表格视图的右侧显示特殊索引列表。如果表视图的行数(总行数)大于或等于此数字,则显示表视图右侧的索引列表,否则不显示。
Here's the UIKit Documentation:
这是 UIKit 文档:
open var sectionIndexMinimumDisplayRowCount: Int // show special section index list on right when row count reaches this value. default is 0
open var sectionIndexMinimumDisplayRowCount: Int // show special section index list on right when row count reaches this value. default is 0