I am a bit confused with what is going on here. In simple terms, I am adding a UILabel to a UIButton. There is an animation taking place, so the nesting is required.

I am calling a "removeFromSuperview" on the container that the button resides in (and inherently, the label resides in) but I always eventually get a memory error and eventually crash.

That said, if I comment out the label creation and placement - I have no issue at all. Do I need to do something further to release the child (label) in this instance? I have tried releasing all of the subviews from superview on the main container, but again the label is nested in the button view.

Have you set overlayView to nil? It looks like that's a property or ivar, so removing it from the superview won't cause it to be deallocated unless you nil it out.
–
rdelmarJul 21 '13 at 19:44

1

Can you also include your removal code specifically?
–
DanJul 22 '13 at 2:40

Thanks @rdelmar - that fixed my issue. I had a function I thought was being called after the animation that specifically handed the nil but after a quick NSLog I realized it was not working.
–
John SloanJul 22 '13 at 14:48