나는 dequeueReusableAnnotationViewWithIdentifier 또는 dequeueReusableCellWithIdentifier를 사용하는 이유가 궁금합니다. 예를 들어 defaultPinID 값은 논리적이 아닙니다. defaultPinID의 값을 변경하면 아무 것도 변경되지 않습니다. 그 경우 dequeueReusableAnnotationViewWithIdentifier (키워드 dequeueReusable)를 사용하는 이유는 무엇입니까? 있는 tableView왜 우리는 dequeueReusable 키워드를 사용합니까?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];// why ?
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
................
...............
return cell;
}
이전에 표시 한 것과 동일한 셀을 사용하고 새 셀을 만들지 않기 때문에 – user1673099