If I have a UIView
, and I add an allocated subview into it (in this case the UIImageView
), when I release the UIView
, will UIImageView
also be released?
I set up my view and a subview like this:
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
UIImage *myImage=[UIImage imageNamed:@"image.png"];
// This is the subview:
UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
imageView.image=myImage;
[view addSubview:imageView];
[imageView release];
Now, when I call:
[view removeFromSuperview];
[view release];
Will the allocated imageView also be released, or should I remove it by removing all of the view's subviews?
Any insight on this topic is greatly appreciated.