i using storyboard , custom cells. trying search. works fine , loads custom cell when tableviewcontroller loads , enter search character, cell returned uitableviewcellstyledefault , can set label, not sure why not picking custom cell. can please help.
sorry repeat of this not figure out how worked.
i using code.
static nsstring *cellidentifier = @"membercell"; membercell *cell = (membercell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; nsdictionary *item = self.searchlist[indexpath.row]; if (cell == nil) { cell = [[membercell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } cell.memberfullname.text = [item[@"full_name"] uppercasestring] ; cell.memberposition.text = [item[@"title"] length] < 1 ? [nsstring stringwithformat:@"%@", item[@"districts"]] : [nsstring stringwithformat:@"%@, %@", item[@"title"], item[@"districts"]]; cell.memberroom.text = [nsstring stringwithformat:@"rm %@", item[@"room_number"] ]; [cell.memberimage setimagewithurl:[nsurl urlwithstring:item[@"image_thumb"]] placeholderimage:[uiimage imagenamed:@"placeholder"]];
deepak
you said "i trying search" - mean added uisearchdisplaycontroller
, trying custom cell appear in results table view? if so, have 2 options:
in
tableview:cellforrowatindexpath:
method need dequeue custom cell main table view , not search results table view. when define cell in tableview in storyboard, storyboard registers tableview, isn't dequeueable other tableview (i confirmed apple engineer responsible storyboards @ wwdc '13). so, code instead:membercell *cell = [self.tableview dequeuereusablecellwithidentifier:cellidentifier];
move custom cell definition standalone xib file (create empty xib, drag uitableviewcell objects list , configure desired). define custom cell class , configure cell class in xib, , can manually register cell type both table views using
registernib:forcellreuseidentifier:
Comments
Post a Comment