我已經設置了自定義單元格的tableview。 customCell是一個類。 繼承人代碼更精確的看法:iphone如何訪問cellForRowAtIndexPath之外的自定義單元格
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row];
NSString *cellIdentifier = [NSString stringWithFormat:@"asd%d", indexPath.row];
customCell *cell = [[tableView dequeueReusableCellWithIdentifier:cellIdentifier] autorelease];
//i tried setting a tag but dunno how to call it afterwards
[cell setTag:indexPath.row];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"customCell" owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
if (cell.imagen != nil) {
[[cell imageView] setImage:[cell imagen]];
} else { /* setup image... */ }
}
-(void) webImageReady:(WebImage *)downloadedImage imageView:(UIImageView *)imageView cellTag:(NSInteger *)cTag
{
// This is the part where i want to access cell.imagen, this is actually wrong...
[[[imageView.superview viewWithTag:cTag] imagen] setImagen:downloadedImage.Image];
[imageView setImage:downloadedImage.Image];
}
好的。現在我想從cellForRowAtIndexPath之外的方法訪問(引用)cell.imagen屬性,更精確地說,在選擇器下載完成(委託) 在此先感謝!
好吧,試試吧..謝謝 – Nicolas 2010-09-14 22:12:06
即時連接Three20到我的項目有困難,任何幫助將不勝感激。 – Nicolas 2010-09-15 15:34:13
我很樂意提供幫助,無論如何,Three20項目都有完整的幫助。 – 2010-09-15 16:53:26