Objective c Don';如果为',则不显示单元格;是零还是什么

Objective c Don';如果为',则不显示单元格;是零还是什么,objective-c,core-data,uitableview,nsfetchedresultscontroller,Objective C,Core Data,Uitableview,Nsfetchedresultscontroller,我有一个CoreData项目和两个实体,分别是MainList和Football 主列表实体有3个属性 列表名; listFavoritePlayer listPlayerValue 足球实体有2个属性 团队名称; teamBestPlayerValue 我从AddFootball viewcontroller添加属性。喜欢 addTeam.teamName = _txtTeamName.text; addTeam.bestPlayerValue = _txtBestPlayer.text;

我有一个CoreData项目和两个实体,分别是MainList和Football

主列表实体有3个属性

列表名; listFavoritePlayer listPlayerValue

足球实体有2个属性

团队名称; teamBestPlayerValue

我从AddFootball viewcontroller添加属性。喜欢

addTeam.teamName = _txtTeamName.text;
addTeam.bestPlayerValue = _txtBestPlayer.text;

addMainList.listName = _txtListName.text;
addMainList.favoritePlayer = _txtFavoritePlayer.text;
addMainList.playerValue = _txtPlayerValue.text;
我从tableviewcontroller获取了MainList

cell.textlabel.text = mainList.listName;
cell.detailTextLabel.text = mainList.playerValue;
现在还可以。通过这种方式,我将球队属性保留到我的足球实体中,并可以使用MainList在我的tableviewcontroller中显示它们

但是。。这里有一个问题

当我只想在我的AddFootballViewController中添加FavoritePlayer时,请使用以下代码

addMainList.favoritePlayer = @"Messi";
MyTableView单元格为空。因为我没有添加mainList.listName和mainList.playerValue。但是我想添加没有listName和playerValue的favoritePlayer,以便从另一个viewcontroller获取

cell.textlabel.text = mainList.listName;
cell.detailTextLabel.text = mainList.playerValue;
我想我需要一个if-else语句或另一个想法

如果cell.textlab.text=nil;别露面

如果选择“开始”。listName=nil;不要把手机拿出来

如果在显示单元格之前为空或为零,则将其删除


除了listName或playerValue之外,我只需要1个属性。

单元格的显示应该基于您事先确定的数据源。我首先过滤数据源以删除不包含mainList.listName和mainList.playerValue的对象。然后。。。重新加载表格