arrays - Send information about checked table view items to server -
i'm building iphone application, have table view items can checked on or off. when user has checked selected items, have send information server. however, don't know optimal way this. should load information array? maybe dictionary? , can give specific examples of how code?
thanks.
no one?
update
to clear, regarding url connections taken care of. need way sort information in array or like, index path of items used represent checked table view cells. after that, i'll convert information json, parse on server. have json encode/decode library, don't need information on how that.
ok, seems solve problem. if knows more elegant solution, please let me know.
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if ([self.tableview cellforrowatindexpath:indexpath].accessorytype == uitableviewcellaccessorycheckmark) { [self.tableview cellforrowatindexpath:indexpath].accessorytype = uitableviewcellaccessorynone; [self.tableview cellforrowatindexpath:indexpath].textlabel.textcolor = [uicolor colorwithred:0.0 / 255 green:0.0 / 255 blue:0.0 / 255 alpha:1]; [selectedsources removeobject:[nsnumber numberwithint:indexpath.row]]; } else { [self.tableview cellforrowatindexpath:indexpath].accessorytype = uitableviewcellaccessorycheckmark; [self.tableview cellforrowatindexpath:indexpath].textlabel.textcolor = [uicolor colorwithred:72.0 / 255 green:104.0 / 255 blue:152.0 / 255 alpha:1]; [selectedsources addobject:[nsnumber numberwithint:indexpath.row]]; } [self.tableview deselectrowatindexpath:indexpath animated:yes]; }
selectedsources
nsmutablearray, json encode , send server. based on index path, can identify table view cells have been checked/unchecked server side.
thanks, anna!
Comments
Post a Comment