In my tableView one of cell's kind not visible in the top of tableView. So when I scroll my tableView I see lag when cell appear. In iPhone 4 it is very big lag. So when tableView dequeue my cells, there are no problem, but when it in first load them form nib, I see lag.
Now I use in viewDidLoad
UINib *nib = [UINib nibWithNibName:NSStringFromClass([MovieDescriptionEventsCell class]) bundle:nil];
[self.tableView registerNib:nib forCellReuseIdentifier:NSStringFromClass([MovieDescriptionEventsCell class])];
So for first 6-8 cells there are lags because they are loaded from nib. How can I create cells before they appear in tableView?
EDIT
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
/////
} else if (indexPath.section == 1) {
MovieDescriptionEventsCell *cell = (MovieDescriptionEventsCell *)[tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MovieDescriptionEventsCell class])];
cell.delegate = self;
cell.maxNumberEvents = eventsMaxNumber;
cell.partPlace = currentDayEvents.partPlaceEvents[indexPath.row];
return cell;
}
}
All magic in cell, but there are no lags after tableview create 6-8 cells (depends from size of cell), only when they are created.
Create it in viewDidLoad
,
store its pointer in dataSource member(for example slowCell
),
return it in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.