iPhone 缓存问题 - UISearchbar
我有一个应用程序,它使用 UISearchBar 使用动态向前搜索,
这就是它的作用..我有 2 个视图; A(列表)& B(详细信息)
在视图 A 上,我有一个 UISearchBar,用户可以在其中键入任何内容,并且下面的列表会动态更新(使用复制的数组),即从外部 Web 服务 API
说一个场景,用户必须键入“WORD” 他将从 W 开始 所以列表将显示“WA”,“WB”,“WC”,“WD”等 现在他将输入第二个字母 O(因此现在搜索词是“WO”) 因此列表将显示“WO1”、“WO2”、“WO3”等
当用户输入 WO 并单击列表中的选项之一(如 WO2)时,他将看到有关 WO2 的详细信息 他从那里点击返回...所以再次向他显示 WO1、WO2、WO3...
现在这是我的问题...如果他现在单击 WO1,即使列表显示 WO1、WO2、WO3... .他被带到有关“WA”的详细信息(即前一个列表中的第一项(即仅在键入“W”时)
所以似乎对前一个索引值有一些缓存,看起来...... 你能帮我解决这个问题吗?
我在大多数事情上都使用数组。搜索结果、推送详情等
I have an app which uses a dynamic forward search using UISearchBar
Here is what it does..I have 2 views; A (List) & B (Detail)
On View A, I have a UISearchBar where the user can type anything and the list below gets updated dynamically (uses copied arrays) i.e. from an external web service API
Say a scenario, user has to type "WORD"
He'll start with W
So list will show "WA","WB","WC","WD", etc
Now he'll type 2nd letter O (so search term now is "WO")
So list will display "WO1","WO2","WO3", etc
At the point where user has typed WO and he clicks on one of the options in the list say WO2, he'll be taken to details abt WO2
He clicks back from there...So again he is shown WO1, WO2, WO3, ...
Now here is my question..if he now clicks on WO1, even though the list is showing WO1, WO2, WO3, ...he is taken to details about "WA" (i.e. first item in the previous list (i.. at the time of typing 'W' only)
So there seems to be some caching abt the previous index value, it seems...
Could you please help me with the issue.
I am using array for most of the things. search result, pushing detail, etc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请提供主列表的数据源和 UISearchDisplayController 的数据源的代码。
似乎在
tableView:didSelectRowAtIndexPath:
中,您得到了错误的对象并将其发送到详细信息控制器。无论如何,您必须在列表视图控制器中的 tableView 之间切换才能为 indexPath 获取正确的对象:
Please, provide code for main list's DataSource and for UISearchDisplayController's DataSource.
It seems that in
tableView:didSelectRowAtIndexPath:
you're getting wrong object and send it to details controller.Anyway, you must switch between tableViews in your list view controller to get right object for indexPath: