섹션이있는 tableView를 열고 닫을 수 있습니다. 따라서 섹션을 탭하여 열면 셀로 채워지고 은 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
에 제공된 것만큼 정확하게 호출됩니다.tableView : cellForRowAtIndexPath : 보이는 셀만 호출하지 않습니까?
맞습니까? 눈에 보이는 세포의 숫자만으로되어서는 안됩니까?
제 경우에는 상황이 좋지 않습니다 : 사용자 정의 셀 (50 ~ 100 셀)을 많이 가지고 있으며 각 셀에 대해 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)
을 호출하면 섹션을 열면 느리게 실행되므로 펜촉에서 읽는 동안 셀 콘텐츠가 이미지로 채워집니다.
if ([[self.tableView indexPathsForVisibleRows] containsObject:indexPath])
NSLog(@"visible %@", indexPath);
을 그것을 셀 (45)의 밖으로부터 만 6 또는 7이 표시되는지 보여준다 I 이렇게 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)
내부 셀의 가시성을 체크했다. 다른 사람들은 눈에 보이는 영역 밖에 있습니다. 그러나 세포를 만드는 것은 여전히 수행되었습니다. 코드는 다음과 같습니다.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"IVCell";
IVCamera *camera = [server.cameras objectAtIndex:indexPath.row];
IVServerListViewCell *cell = (IVServerListViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"IVServerListCell" owner:self options:nil];
cell = (IVServerListViewCell*)_tableViewCell;
self.tableViewCell = nil;
}
[cell textLabel].text = camera.cameraName;
cell.preview = camera.preview;
cell.userData = camera;
cell.isEnabled = (server.isInactive)?NO:camera.isOnline;
return cell;
}
여전히 맞습니까? 또는 나는 무엇인가 놓치고 있냐?
나도 이런 문제가 있었고, 당신의 기술은 너무 유용해서 문제가 해결되었습니다. – Ananth
@Ananth 오신 것을 환영합니다! =) – peetonn