UIViewController & UIview dealloc not getting called

这一生的挚爱 提交于 2019-12-05 05:26:58
B K

OK! Finally understood what the problem was.

Yes it was the delegate. So in my "back button pressed" method, I need to set the delegate to NIL.

-(void)TopNavigationBarBackButtonPressed {

 topBar.delegate = nil;
[self.navigationController popViewControllerAnimated:YES];
}

And voila, all the dealloc get called. Damn you custom Protocol. 2 Days of my life i will never get back.

EDIT: OK no need to set the delegate to nil.

I was having all the problems because in the property i was retaining the delegate.

@property(nonatomic, retain)id <ASNavigationDelegate>delegate;

This should be

@property(assign)id <ASNavigationDelegate> delegate;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!