I want to load about 6,000 - 8,000 lines in a UITableview. I get data from the server using an asynchronous call, and when I get the data that I call
[tableView reloadData]
This is a table update. But for some reason, my application is stuck and freezes. When I debug it, I found that the cellforrowatindexpath is called 6,000 times (in the main thread) and dequeueReusableCellWithIdentifier always returns null.
- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath{ CDTableRowCell *cell = nil; // Create and Resue Custom ViewCell static NSString *CellIdentifier = @"CellIdentifier"; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // got into render/theme objec if(cell == nil){ cell = [[CDTableRowCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } // MODIFYING CELL PROPERTIES HERE FROM AN ARRAY // NO HTTP CALLS }
Also, tableview starts reusing a cell when I start scrolling, but before that I never create a new one. Any clue why this is weird behavior ???
source share