I have created an app with a UISearchbar
and a UITableView
inside a UIPopoverController
. Whenever I perform a search, the table correctly shows the right position needed, but when i dismiss the popover , automatically the current position and the selected cell is lost.
So the situation is, I need when the popover is dismissed, and then re-called, to show me the exact position before the dismissal. My guesses are, when the popover is dismissed, the uitableview gets reloaded to starting position.
N.B. : The problem occurs when I perform the search using the search bar and dismiss the popover, If I don't use the search bar and just scroll down the table view, click on an item , dismiss the popover, and then re-open it, I will get the exact position I left it before dismissal.
This small sketch could help out more :
Any ideas what I may be doing wrong ?
The solution was that i needed to create a new mutable array that saves the newly filtered data. If the user searches an item, a boolean variable will change its value. In the view will appear method, a test on that boolean value will take place : If it had changed, the app will load the newly created mutable array, if not it will load the usual array. Hope this would help someone in the future.