I’m currently busy converting my code to ARC and ran into a little bit of trouble using local variables. As they are only kept in memory as long as the compiler thinks I need them, they usually get released after the last method call to them.
Unfortunately, my application contains a HUD with custom stuff in it, like UIButtons. The selectors of those are pointing to the HUD itself and so I always get an EXC_BAD_ACCESS because the controller was released after it was instantiated.
Is there any solution to this besides creating an instance variable in my class header?
Although it’s really the same thing as putting an iVar in the header, you can at least keep things cleaner by creating a private category at the top of the .m file that defines properties you can hold the UIButtons in.