开发者

Getting data from UITableView

开发者 https://www.devze.com 2022-12-25 16:03 出处:网络
I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this开发者_StackOverflow UIViewController -

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,

Teja


Simple 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消