사용자 지정 셀 유출 문제가 있습니다. 내 재정의있는 UITableViewController에서사용자 지정 셀 누설
, 내가 가진,
- (UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TwitterTweetTableCell *cell = nil;
// Obtain the cell...
cell = [[TwitterTweetTableCell alloc]
initWithTable:tableView
andTweet:[[self getTimeline] objectAtIndex:indexPath.row]];
return [cell autorelease];
}
그리고 해당 겹쳐있는 UITableViewCell 클래스의
,- (TwitterTweetTableCell *) initWithTable:(UITableView *) tableView
andTweet:(NSDictionary *) tweet
{
tweetCell = nil;
// ************************************************************************************
// The identifier used in the following dequeue is the one set in the corresponding nib
// ************************************************************************************
tweetCell = (TwitterTweetTableCell *)
[tableView dequeueReusableCellWithIdentifier:@"tweetCell"]; // <-- set this in NIB
if (tweetCell)
{
NSLog(@"tweetCell: Reuse!");
}
if(!tweetCell)
{
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"TwitterTweetTableCell" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[TwitterTweetTableCell class]])
{
tweetCell = (TwitterTweetTableCell *)currentObject;
break;
}
}
// yadda, yadda, yadda
[tweetCell retain];
}
return tweetCell;
}
이 사용자 정의 셀 (TwitterTweetTableCell)에 해당 NIB이며, 언급 한 바와 같이
코드에서 셀 식별자는 'tweetCell'로 설정됩니다.어쨌든, 악기에 따라, 그것은 내가 하나의 retainCount와 셀을 반환에 대한 올바른 해요 생각
:-(세포 누수 (그것이 ALLOC에서 수익이고 제외하고는 코드가 잘 작동, 내가하지 않으면 그것은 코드와 같이, 그때 마지막으로 테이블 컨트롤러에 전원을 전달하기 전에 autorelease를.) 좀비와 충돌합니다.이 누출 평가 될 것입니다 이유에
생각.
우수! 매우 명확하고, 유익하며, 무엇보다도, 그것은 문제를 해결했습니다. 저에게서 많은 것을 배웠습니다 - 감사합니다, 유지. – Snips