I’ve just noticed something interesting with my UIButton.
I’m currently fading the button out so that button.alpha = 0.0;
Originally I intended to [button removeFromSuperview] as well at this point. However, it seems a button with a 0.0 alpha does not execute, which is about the same as it not being there (and for the purpose of my project, just as fine).
Is this an intended consequence of alpha being 0?
Hidden
UIControls do not respond to events, this includesalpha = 0.0‘ed elements.However, if you do not remove the
UIButtonfrom its superview it might not get deallocated until the superview is deallocated since the superview retains it. This likely isn’t a problem, especially if you might re-fade in the button. Just make sure your memory management is correct.For legibility I would also add
button.enabled = NOeven though it’s unecessary functionaly.