1
你好,我使用EGOImageView惰性圖像加載。我在UITable視圖上使用相同的代碼。 首先我正在配置的單元格,然後配合使用tableviewCellWithReuseIdentifier返回cell.I正在使用的代碼:如何添加懶惰的圖像加載到UIimageview
這是我tableviewCellWithReuseIdentifier我在哪裏用標籤定義的UIImageView:
- (UITableViewCell *)tableviewCellWithReuseIdentifier:(NSString *)identifier
{
if([identifier isEqualToString:@"UICell"])
{
UITableViewCell *uiCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:identifier] autorelease];
uiCell.textLabel.textAlignment = UITextAlignmentCenter;
uiCell.textLabel.font = [UIFont systemFontOfSize:16];
return uiCell;
}
CGRect rect;
rect = CGRectMake(0.0, 0.0, 320.0, 70.0);
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:rect reuseIdentifier:identifier] autorelease];
// [cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
cell.selectionStyle =UITableViewCellSelectionStyleNone;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 70.0)];
imageView.tag = BG_Image;
[cell.contentView addSubview:imageView];
[imageView release];
return cell;
}
,這我在哪裏構成單元的功能:
-(void)configureCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath
{
UIImageView *imageView = (UIImageView *)[cell viewWithTag:BG_Image];
imageView.image = [UIImage imageNamed:@"event_box_bg.png"];
}
,這是我的自我形象代碼初始化後,我想知道如何使用這個代碼,並在那裏
EGOImageView *_eventImageView = [[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"placeholder.png"]];
請幫助..
Tha NKS,
感謝它爲我工作... – gaurav