我有一些从数据库中获取的 JSON 数据。我可以把它拉好并将其加载到我的表格视图中。我的问题是分离我的 JSON 数据,以便我可以对 tableview 进行分区。
JSON
[{"id":"1","name":"steve mans","phoneNumber":"(559)123-4455","showNumber":"1","greenCard":"1","expiration":"2014-02-15","driver":"1","paid":"1","watch":"1"},
{"id":"2","name":"myself and me","phoneNumber":"(559)321-6784","showNumber":"1","greenCard":"1","expiration":"2013-10-18","driver":"0","paid":"0","watch":"2"},
{"id":"4","name":"tod bellesmithson","phoneNumber":"(559)678-3421","showNumber":"0","greenCard":"1","expiration":"2013-11-22","driver":"1","paid":"0","watch":"2"},
{"id":"3","name":"John Smith","phoneNumber":"(559)123-1234","showNumber":"1","greenCard":"0","expiration":"2013-10-08","driver":"0","paid":"1","watch":"3"},
{"id":"5","name":"greg smith","phoneNumber":"559 345-1234","showNumber":"1","greenCard":"1","expiration":"2013-10-08","driver":"0","paid":"1","watch":"3"}]
我想要做的是,在我的表格视图中将这些数据分成三个部分。所以我想创建三个不同的表并将每个表加载到 tableview 的不同部分。但是每个人的信息都是相同的(身份证、姓名、电话等)。所以我最终得到了一张桌子,并添加了一个列,指定人们工作的班次,“观看”。那么如何使用监视列分隔数据,所以在我的表格视图中我将拥有:
第一节 夜班 第二节 早班 第三节 夜班