0
보통 내가 설치할 때 UITableViewCell
기본 cellStyles를 사용하여 필요에 따라 셀을 할당 및 자동 회수합니다. 내 질문은 아래의 예에서 메모리 관리와 관련되어있다. FGCustomCell
은 어디에 할당되어 있습니까? 펜촉에 오브젝트를 요청하면 생성됩니까? 나는 또한 autoreleased 가정하므로 아래의 코드 괜찮습니까?NIB에서 UITableViewCells를 사용한 메모리 관리?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FGCustomCell *customCell = (FGCustomCell *)[tableView dequeueReusableCellWithIdentifier:@"FGCELL_ID"];
if(customCell == nil) {
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"FGCustomCell" owner:self options:nil];
for(id eachObject in nibObjects) {
if([eachObject isKindOfClass:[FGCustomCell class]]) customCell = (FGCustomCell *)eachObject;
}
}
return customCell;
}