0

i have a UIView [self] with 2 custome UIViews [articalBottomPanel] [movingSharePanel]

every custome view is declared in a single class

first view [articalBottomPanel] delegate's will be set to self

second view will take also [self.artical] , [self]

as here :

[self.articalBottomPanel setDelegate:self];
[self.articalBottomPanel.btnCommment addTarget:self action:@selector(commentBtnPressed:) forControlEvents:UIControlEventTouchUpInside]; 



[self.movingSharePanel setArtical:self.artical];
[self.movingSharePanel setParentView:self];  

My dealloc is

- (void)dealloc
{
    NSLog(@"ArticalViewController : dealloc");


    [movingSharePanel_ release];
    [articalBottomPanel_   release]; 


    [super dealloc];
}

the problem is : when i pop the view [self] dealloc not called ?!

the question is : before pop this view [self] , is it want to do any releases more than the release at delloc ?!

Yahia
  • 572
  • 1
  • 5
  • 24

2 Answers2

1

Have you made delegate as @property(retain)? If yes then make it assign. If not then make sure your ViewController is released. Check if after pushing it, you release it or not.

Ved
  • 587
  • 5
  • 10
  • it's (assign) , before pop [self retainCount] :2 after pop [self retainCount] :4 – Yahia Oct 10 '11 at 12:43
  • ok , now it's changed , tried to do this [self.movingSharePanel setParentView:nil]; self.datafetcher.articalContentFetcherDelegate =nil; [self.datafetcher release]; now dealloc is called , any explanations ?! – Yahia Oct 11 '11 at 07:28
  • You were definitely retaining in one of these [self.movingSharePanel setArtical:self.artical]; [self.movingSharePanel setParentView:self]; Thing is that you should avoid creating a retain-retain cycle. That is ClassA retains ClassB and ClassB retains ClassA. None of it will be deallocated unles you break the cycle. Here you are breaking it by setting them nil. It's a guess though ;) – Ved Oct 11 '11 at 18:38
1

retainCount is useless. Don't call it.

Specifically, the absolute retain count of an object is an irrelevant implementation detail that should generally be ignored (it is only useful if you also have an exact inventory of every retain/release, but if you have that, the retain count isn't useful, either).

See this answer for a brilliant explanation of how to track down exactly who/what is still retaining the object.

Community
  • 1
  • 1
bbum
  • 160,467
  • 23
  • 266
  • 355