Objective C UITableView 100 000 个条目
我想创建一个动态搜索并显示匹配条目的 UITableView。我的问题是我不知道如何存储这些条目。我认为纯文本文件或属性列表是没有问题的,因为对于这些类型,整个数据都会在开始时加载。 有人有这些文件类型的替代品吗?我读到了有关 sqlite 的内容,但这适合 100 000 个条目吗?是否可以高效地搜索条目? (我目前有一个文本文件中的表格。条目由特定字符串分隔。)
提前致谢!
I want to create a UITableView that dynamically searches and displays matching entries. My problem is that I do not know how to store these entries. I think a plain textfile or a property list is out of question, because with those types, the whole data is loaded at the beginning.
Does anyone have an alternative to these filetypes? I read about sqlite, but is this suitable for 100 000 entries? And is it possible to performantly search for entries? (I currently have the table in a text file. The entries are seperated by a certain string.)
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Core Data 可能是一个值得研究的 API
http://developer.apple.com/ library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
核心数据可以由多种存储机制支持,其中之一是 sqlite。 Sqlite 可能是处理如此多数据的最佳选择。
Core Data may be one API worth researching
http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
Core Data can be backed by several storage mechanisms, one being sqlite. Sqlite is probably your best bet for so much data.
SQLite 或 Core Data(使用 SQLite)都是合适的,并且应该能够毫无问题地处理该大小的数据集。
我认为您会发现即使表中有那么多行,UITableView 也会做出可接受的响应。不过,您永远不会希望用户实际上滚动浏览 1000 行,更不用说 100,000 行了,因此请确保为用户提供一个过滤器,以便在他们必须查看数据之前真正减少行数。
重要提示:请确保表格单元格使用固定的行高。如果您使用可变行高,UITableView 会询问您表中每一行的高度,以便计算出表的总高度。获得良好性能的唯一方法是使用固定高度。
Either SQLite or Core Data (which uses SQLite) would be appropriate and should be able to handle data sets of that size with little problem.
I think you'll find that UITableView will respond acceptably even when you have that many rows in the table. You'd never want the user to actually scroll through even 1000, let alone 100,000 rows, though, so make sure you give the user a filter to really cut down the number of rows before they have to look at the data.
Important: Make sure you use a fixed row height for your table cells. If you use a variable row height, UITableView will ask you for the height of every single row in the table just so it can figure out the total height of the table. The only way you'll get decent performance is to use a fixed height.