alexanderjarvis / PXAlertView

A drop-in replacement for UIAlertView that is more customisable and skinnable
MIT License
592 stars 95 forks source link

Set alertWindow.rootViewController = nil #27

Closed forgot closed 10 years ago

forgot commented 10 years ago

In the demo, when calling show5StackedAlertViews:, self.alertWindow is remaining, even though it is set to nil, and is blocking the main window. I was able to confirm this using Reveal. Setting alertWindow.rootViewController to nil seems to clear this up.

Out of curiosity, would this be due to something holding a reference to alertWindow, and not allowing ARC to release it? I'm still trying to get a handle on all this, and while I was able to make it work, I want to make sure I correctly understand how I made it work.

alexanderjarvis commented 10 years ago

Thanks for this. I think that the reason may be because alertWindow is not set using the self. setter (it uses the internal _alertWindow ivar directly) so clearning it with self.alertWindow = nil is expected to have no effect since it was not set accordingly. Also note that clearing it was another earlier pull request.

Much of my code that I write now makes use of assigning properties using self. instead. Perhaps I should go through and refactor the code as it's been a while since I have touched it and I'm sure I'll find other nuances where my ObjC has improved since it was written. Maybe the .rootViewController would not need to be set to nil after this. Feel free to experiment yourself, you just need to change it in the init method.