Sunday, 15 September 2013

iphone - search results tableview not displaying the contents of its cells even while filtering of the contents of the table is working fine -



iphone - search results tableview not displaying the contents of its cells even while filtering of the contents of the table is working fine -

i have viewcontroller containing multiple tableviews managed same viewcontroller.i added search 1 of tableviews... have added searchbar amd searchisplaycontroller , wired outlets searchdelegate,searchdatasource,searchbar.etc...

i have code filtering contents of table working correctly...

below code within cellforrowatindexpath method

static nsstring *simpletableidentifier = @"search"; searchfieldscell *cell = [tableview dequeuereusablecellwithidentifier:simpletableidentifier]; if (cell == nil) { cell = [[searchfieldscell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:simpletableidentifier]; } nsdictionary *field=nil; if (tableview == self.searchdisplaycontroller.searchresultstableview) { field = _searchfieldsarray[indexpath.row]; } else{ field = _fieldsarray[indexpath.row]; } cell.titlelabel.text=field[@"a"]; cell.subtitlelabel.text=field[@"b"]; cell.detaillabel.text=field[@"c"]; cell.flagimage.image=[uiimage imagenamed:@"ic_flag.png"]; homecoming cell;

but not displaying contents of tableview... height of tableviewcell set , during runtime... if give printobject po cell.titlelabel.text in debug console gives result like

<uilabel: 0xc15d500; frame = (70 0; 241 21); text = 'result'; userinteractionenabled = no; layer = <calayer: 0xc15d5b0>>

i farther found out line of code searchfieldscell *cell=[tableviewdequeuereusablecellwithidentifier:simpletableidentifier];

is working ie loading prototype cells storyboard line

if (cell == nil) { cell = [[searchfieldscell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:simpletableidentifier]; }

is returning empty white cells somehow not loading prototype cells storyboard... how can happen...?? please help...

try type cast cell custom cell class. initialize & not null value.

searchfieldscell *cell = (searchfieldscell *)[tableview dequeuereusablecellwithidentifier: simpletableidentifier];

hopefully, help you.

thanks.

iphone uitableview ios7 uisearchbar uisearchdisplaycontroller

No comments:

Post a Comment