rnystrom / RNBlurModalView

Add depth to your alerts.
MIT License
830 stars 143 forks source link

Button in custom view causes EXC_BAD_ACCESS when pressed #16

Open raphneve opened 11 years ago

raphneve commented 11 years ago

Hi there, and thanks for a nifty component. I am using the following code to present a custom view :

    AproposView *apropos = [[AproposView alloc] initWithNibName:@"AproposView" bundle:nil];
    RNBlurModal *blurModal = [[RNBlurModalView alloc] initWithViewController:self view:apropos.view];
    [blurModal show];

In the AproposView, I have a button, which when I press generates an EXC_BAD_ACCESS message. I also tried other methods such as putting a tapgesture on an UIImageView but the result was the same.

Any pointers appreciated !

rnystrom commented 11 years ago

More than likely it's because the apropos object is autoreleased. I'd try to either create a property of type AproposView of your class that you're calling this code, or better yet, abstract your view to its own class so you can initialize it without needing to create a VC object.