objective c - Don't show Cell if it's nil or something like that -
i have coredata project , 2 entity names mainlist , football..
mainlist entity has 3 attriubutes ;
listname; listfavoriteplayer listplayervalue
football entity has 2 attributes;
teamname; teambestplayervalue
i add attributes addfootball viewcontroller. ;
addteam.teamname = _txtteamname.text; addteam.bestplayervalue = _txtbestplayer.text; addmainlist.listname = _txtlistname.text; addmainlist.favoriteplayer = _txtfavoriteplayer.text; addmainlist.playervalue = _txtplayervalue.text;
i fetched mainlist tableviewcontroller.
cell.textlabel.text = mainlist.listname; cell.detailtextlabel.text = mainlist.playervalue;
it's ok now. in way keep team attributes football entity , can show them in tableviewcontroller mainlist.
but.. there problem here ;
when want add favoriteplayer in add footballviewcontroller code.
addmainlist.favoriteplayer = @"messi";
mytableview cell comes empty. because didn't add mainlist.listname , mainlist.playervalue. want add favoriteplayer without listname , playervalue fetch viewcontroller.
i think need if else statement or think.
if cell.textlabel.text = nil; don't show
or
if selectedrow. listname = nil ; don't show cell.
or
delete them if empty or nil before show cell.
i want 1 attributes except listname or playervalue.
the displaying of cells should based on datasource determine beforehand. first filter data source remove objects not contain mainlist.listname , mainlist.playervalue. , ... reload table.
Comments
Post a Comment