将有关已检查表视图项目的信息发送到服务器
我正在构建一个 iPhone 应用程序,其中有一个表格视图,其中包含可以检查或关闭的项目。当用户检查了所选项目后,我必须将该信息发送回我的服务器。但是,我不知道执行此操作的最佳方法。我应该将信息加载到数组中吗?也许是一本字典?您能否给出如何使用代码执行此操作的具体示例?
谢谢。
没有人?
更新
需要明确的是,有关 URL 连接的所有内容都已处理完毕。我所需要的只是一种对数组等中的信息进行排序的方法,其中项目的索引路径用于表示选中的表视图单元格。之后,我会将信息转换为 JSON,然后在服务器上进行解析。我有一个 JSON 编码/解码库,因此我不需要任何有关如何执行此操作的信息。
I'm building an iPhone application, where I have a table view with items that can be checked on or off. When the user has checked the selected items, I have to send that information back to my server. However, I don't know the optimal way to do this. Should I load the information into an array? Maybe a dictionary? And can you give specific examples of how to do this with code?
Thanks.
No one?
Update
To be clear, everything regarding URL connections is taken care of. All I need is a way to sort the information in an array or the like, where the index path of the items is used to represent the checked table view cells. After that, I'll convert the information to JSON, which I will then parse on the server. I have a JSON encode/decode library, so I don't need any information on how to do that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,这似乎解决了我的问题。如果有人知道更优雅的解决方案,请告诉我。
selectedSources
是一个 NSMutableArray,然后我对其进行 JSON 编码并发送给我的服务器。根据索引路径,我可以识别哪些表视图单元格已在服务器端被选中/未选中。谢谢,安娜!
OK, this seems to solve my problem. If someone knows a more elegant solution, please let me know.
selectedSources
is an NSMutableArray, which I then JSON encode and send to my server. Based on the index path, I can then identify which table view cells have been checked/unchecked server side.Thanks, Anna!