我有2个数组。
postList:[
{id: 1, name: "json", content: "hi", sex: "male"},
{id: 2, name: "bob", content: "hello", sex: "male"},
{id: 3, name: "john", content: "wow", sex: "male"},
{id: 3, name: "john", content: "unbelievable", sex: "male"}
]
blockList: [
{id: 3, name: "john"},
{id: 4, name: "allen"}
]
Tableview由postList数据组成。我希望如果lockList.id==postList.id,单元格应该被隐藏。如何比较2个数组和隐藏单元格?
1条答案
按热度按时间xdnvmnnf1#
@hor比较数据数组并创建结果数组
然后使用结果数组将数据设置到表视图
请参阅以下内容:
在上面的示例中,您可以使用filteredArray将数据设置到您的表视图中