Reputation: 18253
This is the situation:
A user filters a database by selecting keywords from a list, then presses "search". This pushes an instance of a UITableViewController subclass onto the navigation stack.
In the viewWillAppear: method, data are fetched from Core Data and stored in an ivar, ready for the table view's data source and delegate methods.
So far so good.
The UI problem arises when there are no results.
This simple architecture means that an empty result set yields an empty table view with no explanations.
It would be good for the UI to tell the user something like "Your search gave no results, please try with fewer keywords".
My question is this:
What is the best way to provide relevant feedback to the user, without having to change the architecture too much?
I was thinking about using the table header, but what do my esteemed colleagues here think?
Upvotes: 0
Views: 305
Reputation: 93
You can put AlertView when your ivar is empty and in alert button index return to the main view from where you are entering your search. This is the best way for you without changing your architecture.
Upvotes: 0
Reputation: 9866
After fetching the result from core data... just count the number of rows in the result and then before displaying Table View just check if Count>0 then only go for table view ... else just display UIAlertView... this will save u from unnecessary display of UITableView
Upvotes: 0
Reputation: 3980
You could add / show a UILabel to your view that says "No search results" (or something like that) when the table does not contain any data.
Upvotes: 0
Reputation: 26400
Using the table header is not a bad option. You can go for that. You can also try other options like showing the info in a simple label or perhaps even an alert. But personally I wouldnt recommend the alert.
Upvotes: 1