ios - NSMutableArray Datasrouce TableView UI Freeze after scroll -


i developing ios 10 xcode version 8.0.

in .h file, have

@property (nonatomic, strong) nsmutablearray *items; 

which datasource tableview.

in viewdidload, call function [self setuptableviewitems];

self.items = [[nsmutablearray alloc] initwithcapacity:4]; self.items = [cellmodel rows]; 

every object inside of array representing cells, example:

cellmodel *screenshot = [[cellmodel alloc]                             initwithparams:         @"screenshot"                             subtitle:               @"select screenshot"                             image:                  [uiimage imagenamed: @"screenshot"]                             viewname:               pictures                             section:                3]; 

here method signature,

+ (nsmutablearray *)rows; 

and important implementations details (every object of type cellmodel):

nsmutablearray *screenshots = [[nsmutablearray alloc] initwithcapacity:3]; [screenshots addobject:quickscreenshot]; [screenshots addobject:selectscreenshot]; [screenshots addobject:selectedscreenshotscollectionview]; 

.....

nsmutablearray *datasource = [[nsmutablearray alloc] initwithcapacity:4]; [datasource addobject:interactions]; [datasource addobject:screenshots]; [datasource addobject:problem]; [datasource addobject:details];  return [datasource mutablecopy]; 

the tableview loads data correctly first time, view looks great , nothing missing.

when start scrolling, immidetely notice accessoryviews cells start getting mixed up, on section 3, defined not have acessory view, still gets mixed , other cell's accessory views.

however, orientation changes, or start scrolling , down few times, ui locked, no crash, no message xcode. memory growing , leak, after trying find hours, desperate.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { generictableviewcell *cell = [tableview                                   dequeuereusablecellwithidentifier:report_cell                                   forindexpath: indexpath];  cellmodel *current = [[self.items objectatindex:indexpath.section] objectatindex:indexpath.row];   cell.titlelabel.text = current.title; cell.subtitlelabel.text = current.subtitle; cell.icon.image = current.image;      if(indexpath.section == 0 && indexpath.row == 0)         cell.accessoryview = self.lastinteractionswitch;     else if(indexpath.section == 0 && indexpath.row == 1)         cell.accessorytype = uitableviewcellaccessorydisclosureindicator;     else if(indexpath.section == 1 && indexpath.row == 0)         cell.accessoryview = self.lastscreenshotswitch;     else if(indexpath.section == 1 && indexpath.row == 1)         cell.accessorytype = uitableviewcellaccessorydisclosureindicator;     else if(indexpath.section == 2 && indexpath.row == 0)         cell.accessoryview = self.starratingview;     else if(indexpath.section == 2 && indexpath.row == 1)         cell.accessoryview = self.speechtotextbutton;     else cell.accessoryview = uitableviewcellaccessorynone; return cell; 

my custom cell has 3 properties, ones being set. custom cell of type "subtitle", , properties connected in ib.

first, thought because didn't have pointer reference, added it, tried intiutive , obvious ones (strong || retain), moved on having nsarray datasource, same problem. changed cell (to 100% apple, 100% custom), same problem.

what happening here?

what height of row cell.?

also did checked data object section 3?

cellmodel *current = [[self.items objectatindex:indexpath.section] objectatindex:indexpath.row]; cell.titlelabel.text = current.title; cell.subtitlelabel.text = current.subtitle; cell.icon.image = current.image; 

Comments