I was confuse with memory management of removeFromSuperview.
Here is my code:
MySubView *tMySubView = [[MySubView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
tMySubView.center = self.view.center;
tMySubView.tag = 1111;
[self.view addSubview:tMySubView];
[tMySubView release];
"self" is UIViewController.
When "self" call dealloc but MySubView didn't call dealloc.
I know addSubView retainCount +1.
So I try add [tMySubView removeFromSuperview] in "self" dealloc
And MySubView dealloc was called...
Should I add [subView removeFromSuperview]; when superView dealloc?
Or superView removeFromSuperview ,it will automaticly call subView's removeFromSuperview...?
I can't figure it out. :(
Thanks!