您好我工作的UITableView自定义单元格的Twitter,为每个单元格我添加UIImageView(userPhoto),UILabel(名称),UILabel(tweet),UILabel(数据)要dealloc的所有元素,iPhone:如何dealloc自定义单元格标签
请到通过仪器工具ALLOC屏幕的附加拍摄的图像
当我运行的仪器工具,它表现出一些不dealloc的,怎样的dealloc, 这是我的代码
//自定义表格视图单元格的外观。 - (的UITableViewCell *)的tableView:(UITableView的*)的tableView的cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewStyleGrouped reuseIdentifier:nil];
//cell.selectionStyle = UITableViewCellSelectionStyleNone;
UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(72,3,242,15)] ;
name.text = (NSString*)[(Tweet*)[tweetArray objectAtIndex:indexPath.row] userName];
[name setFont:[UIFont fontWithName:@"Helvetica" size:13]];
name.textColor=[UIColor colorWithRed:250 green:250 blue:210 alpha:0.5];
[name setBackgroundColor:[UIColor clearColor]];
UILabel *date = [[[UILabel alloc]initWithFrame:CGRectMake(200,3,130,15)] autorelease];
date.text = (NSString*)[(Tweet*)[tweetArray objectAtIndex:indexPath.row] created_at];
[date setFont:[UIFont fontWithName:@"Helvetica" size:12]];
date.textColor=[UIColor colorWithRed:250 green:250 blue:210 alpha:0.5];
[date setBackgroundColor:[UIColor clearColor]];
UILabel * tweetLabel = [[UILabel alloc]initWithFrame:CGRectMake(72,20,242,60)] ;
tweetLabel.text = (NSString*)[(Tweet*)[tweetArray objectAtIndex:indexPath.row] tweet];
tweetLabel.numberOfLines = 3;
tweetLabel.textColor=[UIColor colorWithRed:252 green:148 blue:31 alpha:1];
[tweetLabel setFont:[UIFont fontWithName:@"Helvetica" size:12]];
[tweetLabel setBackgroundColor:[UIColor clearColor]];
UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(6,10,58,60)] ;
NSURL *url = [NSURL URLWithString:[(Tweet*)[tweetArray objectAtIndex:indexPath.row] image_url]];
NSData *data = [NSData dataWithContentsOfURL:url];
[myImage setImage: [UIImage imageWithData:data]];
[cell.contentView addSubview:myImage];
[cell.contentView addSubview:tweetLabel];
[cell.contentView addSubview:name];
[cell.contentView addSubview:date];
[myTweetActivityIndicator stopAnimating]; [myTweetActivityIndicator setHidesWhenStopped:YES];
return cell;
}
请指导我 谢谢
嗨Harinder,所有这些UIImage和UILabels发布,并且我做了自动释放,它显示NSUrl,[myImage setImage:[UIImage imageWithData:data]]中的一些泄漏; //此线很多与此,,,,即使我也释放UIImage和UILabel也显示dellocation没有发生,请告诉我 谢谢 – 2011-02-02 14:26:45