0
我想從fetchedResultsController發送一個對象到一個自定義單元格。如何將對象從fetchedResultsController傳遞給自定義單元格?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// ...
TWMainViewExpandedCell *cell = (TWMainViewExpandedCell *)[tableView dequeueReusableCellWithIdentifier:StandardExpandedCellIdentifier];
if (cell == nil) {
cell = (TWMainViewExpandedCell *)[[[NSBundle mainBundle] loadNibNamed:@"MainViewStandardCellExpanded" owner:self options:nil] objectAtIndex:0];
}
Work *work = [_fetchedResultsController objectAtIndexPath:indexPath];
cell.workInfo = work; // <- NSLog work.description confirms object exists!
return cell;
// ...
}
而且從我的自定義單元格的h和.m文件
.H
@property (strong, nonatomic) Work *workInfo;
.M
- (void) awakeFromNib {
// ...
NSLog(@"%@", _workInfo); // <- why is this nil?
// ...
}
_workInfo,將返回零!我在這裏錯過了什麼?我如何將對象傳遞給我的自定義單元格?
我可以完美地設置一個文本標籤,但不能從我的FRC發送一個對象?
謝謝!
太棒了,謝謝。 =) – nmdias