1
我正在查看来自WWDC#2010的TableViewUpdates示例代码中的TVAnimationGestures。在他们看来控制器的子类,他们有一个这样的插座:对于UITableViewCell的子类,是否保留或分配为该UITableViewCell的属性
@property (nonatomic, assign) IBOutlet QuoteCell *quoteCell;
,然后在他们的cellForRowAtIndexPath创建它:
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
static NSString *QuoteCellIdentifier = @"QuoteCellIdentifier";
QuoteCell *cell = (QuoteCell*)[tableView dequeueReusableCellWithIdentifier:QuoteCellIdentifier];
if (!cell) {
UINib *quoteCellNib = [UINib nibWithNibName:@"QuoteCell" bundle:nil];
[quoteCellNib instantiateWithOwner:self options:nil];
cell = self.quoteCell;
self.quoteCell = nil;
if ([MFMailComposeViewController canSendMail]) {
UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
[cell addGestureRecognizer:longPressRecognizer];
[longPressRecognizer release];
}
else {
NSLog(@"Mail not available");
}
}
Play *play = (Play *)[[self.sectionInfoArray objectAtIndex:indexPath.section] play];
cell.quotation = [play.quotations objectAtIndex:indexPath.row];
return cell;
}
我的问题是,为什么他们所使用的属性分配,而不是挽留?谢谢。