cocoa touch - Removing View from its SuperView, Notifying the Subviews on iPhone -


What happens when the scene is removed from its super view? Does this sub-idea get any message? For example, my Subview 2 and Subview 3 have been added to Subview 1 like

superview -> Subview 1 -> Subview 2 -> Subview 3

If I click on Subview 1 Delete

  [subview1 removeFromSuperview] by;  

What are its sub-views (Subview 2 and Subview 3) received?

Is there a way to find SubViews that their super view has been removed?

It depends on the number of subview2 and subview3 retains. If you make them through [[UIView alloc] initWithFrame: frame, and add them as subviews, then they will have a number of 2 will be maintained. (Or 3, if you have a reference in a retained property, i.e. self.subview2 = [[... ...

So if you want them to be released, when Subview 1 Is released, make sure you add them as a sub-release and release another release, so that they are calculated from one to only one being added as a subview.

  UIView * subview2 = [[UIView alloc] initWithFrame: myFrame]; [subview1 addSubview: subview2]; [SubView2 release];  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -