Вопрос

I hav a navigation controller and one thing I couldn't seem to grasp is why when I pop a view controller, it isn't released.

When I add it to the navigation controller I release it, this to me meant that now the navigation controller is responsible for managing the view controller.

But when I pop the navigation controller, I can see that the view controllers that are popped still hang around. I know this because the notification observers are still executing.

Also I tried removing the navigation controller from the view, releasing and setting it to nil, and yet still my view controllers are hanging around.

Where and how can I release the view controllers form a navigation controller either when they are popped or when I release the navigation controller itself?

Thanks.

Это было полезно?

Решение

You mention notification observers...is the view controller added to the notification center then? If that is the case I think the notification center is retaining the view controller. In viewWillDisappear remove it as an observer then in dealloc throw out an NSLog and see if it's releasing correctly now.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top