从JSON文件中保存和加载表视图?

时间:2023-01-24 10:00:28

I'm sorry this questions won't perfectly to conform to what stack overflow wants questions to look like, but I have a general questions about a programming technique.

很抱歉,这个问题不完全符合stack overflow想要的问题是什么样子的,但是我有一个关于编程技术的一般性问题。

In my case, the user can manually add and edit his table view cells. After he's finished editing it, is it possible to "save" the resulting table view into a JSON file? I want it to upload then to firebase, so that another user can download it, read the data from the JSON file and have the same view controller in front of him.

在我的例子中,用户可以手动添加和编辑他的表视图单元格。完成编辑后,是否可以将结果表视图“保存”到JSON文件中?我希望它随后上载到firebase,以便另一个用户可以下载它,从JSON文件中读取数据,并在他面前拥有相同的视图控制器。

How is that possible? Is that possible? And if not, which "technique" would you use for doing it?

这怎么可能?这有可能吗?如果没有,你会用什么“技术”来做?

2 个解决方案

#1


1  

The data in a UITableView is backed by a UITableViewDataSource. The class you write to implement this just provides cells on demand from some data. It could also provide JSON.

UITableView中的数据由UITableViewDataSource支持。要实现此目的而编写的类仅根据某些数据的需要提供单元格。它还可以提供JSON。

So, it's not the table that does this, but instead the class you implement to fill the table with data.

因此,做这个的不是表,而是要实现的类来填充表中的数据。

#2


0  

You can save things with core data. Building a JSON file is not hard. Try this links

你可以用核心数据保存东西。构建一个JSON文件并不困难。试试这个链接

http://www.appcoda.com/fetch-parse-json-ios-programming-tutorial/ http://maniacdev.com/2013/04/library-for-integrating-web-services-turning-json-data-into-core-data-backed-native-objects

http://www.appcoda.com/fetch-parse-json-ios-programming-tutorial/ http://maniacdev.com/2013/04/library-for-integrating-web-services-turning-json-data-into-core-data-backed-native-objects

#1


1  

The data in a UITableView is backed by a UITableViewDataSource. The class you write to implement this just provides cells on demand from some data. It could also provide JSON.

UITableView中的数据由UITableViewDataSource支持。要实现此目的而编写的类仅根据某些数据的需要提供单元格。它还可以提供JSON。

So, it's not the table that does this, but instead the class you implement to fill the table with data.

因此,做这个的不是表,而是要实现的类来填充表中的数据。

#2


0  

You can save things with core data. Building a JSON file is not hard. Try this links

你可以用核心数据保存东西。构建一个JSON文件并不困难。试试这个链接

http://www.appcoda.com/fetch-parse-json-ios-programming-tutorial/ http://maniacdev.com/2013/04/library-for-integrating-web-services-turning-json-data-into-core-data-backed-native-objects

http://www.appcoda.com/fetch-parse-json-ios-programming-tutorial/ http://maniacdev.com/2013/04/library-for-integrating-web-services-turning-json-data-into-core-data-backed-native-objects