saikamesh
saikamesh

Reputation: 4629

Dealloc of UITableView not called

I have created some UITableViews in storyboard and written custom classes for each of them. I have dragged and dropped the tableview objects into my main view controller to access them. In the UITableView custom classes, I allocate some class level objects in "numberOfSectionsInTableView" delegate method. I want to release all the class level objects allocated in the numberOfSectionsInTableView method in the dealloc method. But the dealloc is not getting called even if I move to some other view controller. Does anyone have any idea why this is not called, or where else I can release these objects. (ARC is turned off)

Upvotes: 0

Views: 1302

Answers (2)

Janosch Hübner
Janosch Hübner

Reputation: 1694

Here are some things you could do:

  1. turn ARC on?
  2. Are you sure its not accessed? make an NSLog(@"ACCESSED"); in your dealloc method
  3. use viewDidUnload method to release things
  4. directly release them in their methods if they are not needed anymore

Upvotes: 1

Valentin Shamardin
Valentin Shamardin

Reputation: 3658

Try to find something about UIViewController life cycle. Try to release your objects in viewDidUnload method and put breakpoints there. This pic should be useful for you: enter image description here

Upvotes: 1

Related Questions