Je reçois le décompte d'allocation plus un dans le code ci-dessous.Obtenir le compte d'allocation plus un à UIImage dans l'objectif-c?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"MasterViewIdentifier"] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellEditingStyleNone;
UIView* elementView = [ [UIView alloc] initWithFrame:CGRectMake(5,5,312,480)];
elementView.tag = 0;
[cell.contentView addSubview:elementView];
[elementView release];
}
UIView* elementView = [cell.contentView viewWithTag:0];
for(UIView* subView in elementView.subviews)
{
[subView removeFromSuperview];
}
if(indexPath.section==0)
{
if(indexPath.row==0)
{
// i have tried like this but getting exception.
/*
UIImage *cellBackImag=[UIImage imageNamed:@"celltop.png" ];
UIImageView* imaeView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 43)];
imaeView.image=cellBackImag;
[elementView addSubview:imaeView];
[imaeView release];
[cellBackImag release];
*/
// here I am getting uiimage count allocation count
UIImageView* imaeView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"celltop.png" ]];
imaeView.frame=CGRectMake(0, 0, 300, 43);
[elementView addSubview:imaeView];
[imaeView release];
S'il vous plaît, aidez-moi cela, Merci, Madan Mohan
+1. Ignorez le nombre réel, utilisez la gestion de la mémoire appropriée (si vous le possédez, vous êtes responsable de la libérer) et utilisez Instruments pour rechercher les fuites réelles. – Abizern