I have a series of images in a开发者_StackOverflow中文版 tableview, and I want to give users the option to value each image +1 or -1. The images come from a database, and obviously i dont want each user to be able to rate more than once.
I can only think up one solution; and that's creating another table with the image id's, device id's and 'kudos'. It would however need to check with the database every time an image is loaded for a specific device.
Can anyone think of a better solution?
Storing the images' votes in a DB is a good solution, as long as you are able to fetch them in time for display in the tableview - I recommend you use Core Data and check out NSFetchedResultsController which is just what you need, it is smart enough to update the table when there is a change to the votes, to pre-fetch the votes for the visible and the nearby cells, etc.
精彩评论