I have a few custom UITableViewCells -
http://img11.imageshack.us/i/customfacilitiescell.png/
which are added to this开发者_StackOverflow UIViewController -
http://img189.imageshack.us/i/facilitycontroller.png/
Now, on clicking a button in the controller, I'd like to get the on/off status of all the UISwitches in the controller.
Thanks,
TejaSimple answer: you should never store model data in your views. This is a universally good idea, but an absolute must when dealing with UITableViews. Otherwise, as soon as a cell is scrolled off screen, your data is lost.
Store the on/off status of your switches in a model object (such as mutable array) and use this data to update your UI (and vice versa update the model when the user makes a change in the UI).
精彩评论