rnystrom / RNBlurModalView

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

Parent View become blurred after dismissing RNBlurModalView #40

Open tyegah opened 10 years ago

tyegah commented 10 years ago

I use the library to show a modal view with buttons inside. If any of the buttons is clicked, it will dismiss the RNBlurModalView (by calling [modalView hide]) and show a standard modal view. After dismissing the standard modal view, the parent view is being shown. but when I display another standard modal view from the same parent view and dismiss it, the whole parent view becomes blurred.

Is there anyone out there facing this issue?

ansani commented 10 years ago

Hi! Did you use latest release from GitHub ? I fixed a similar BUG about blurred parent view. Can you attach some code example ? Tnx

(My fix: https://github.com/rnystrom/RNBlurModalView/pull/22)

tyegah commented 10 years ago

Hi @ansani , Thank you for replying.

I think I am using the latest release, I've downloaded it a few weeks ago. Here's my code

@interface MyController ()

@property (strong, nonatomic) RNBlurModalView *modalView;

@end

And here's how I present and dismiss the modal view

//present the modal view

 UIView *checkOutView = [[UIView alloc] initWithFrame:CGRectMake(0,0,400,250)];
    checkOutView.backgroundColor = [UIColor lightGrayColor];
    UILabel *lblCheckOut = [[UILabel alloc] initWithFrame:CGRectMake(checkOutView.frame.size.width/2 - 125, 15, 250, 25)];
    lblCheckOut.text = @"Checkout";
    lblCheckOut.textAlignment = NSTextAlignmentCenter;
    lblCheckOut.textColor = [UIColor blackColor];
    [checkOutView addSubview:lblCheckOut];

    UIButton *btnPurchase = [[UIButton alloc] initWithFrame:CGRectMake(checkOutView.frame.size.width/2 - 125, 65, 250, 35)];
    [btnPurchase setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:200/255.0 alpha:1.0] forState:UIControlStateNormal];
    [btnPurchase setTitle:@"Purchase" forState:UIControlStateNormal];
    [btnPurchase addTarget:self action:@selector(purchaseClicked:) forControlEvents:UIControlEventTouchUpInside];
    btnPurchase.backgroundColor = [UIColor whiteColor];
    [checkOutView addSubview:btnPurchase];

    UIButton *btnRedemption = [[UIButton alloc] initWithFrame:CGRectMake(checkOutView.frame.size.width/2 - 125, 115, 250, 35)];
    [btnRedemption setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:200/255.0 alpha:1.0] forState:UIControlStateNormal];
    [btnRedemption setTitle:@"Redemption" forState:UIControlStateNormal];
    [btnRedemption addTarget:self action:@selector(redemptionClicked:) forControlEvents:UIControlEventTouchUpInside];
    btnRedemption.backgroundColor = [UIColor whiteColor];
    [checkOutView addSubview:btnRedemption];

    UIButton *btnTimeStamptOut = [[UIButton alloc] initWithFrame:CGRectMake(checkOutView.frame.size.width/2 - 125, 165, 250, 35)];
    [btnTimeStamptOut setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:200/255.0 alpha:1.0] forState:UIControlStateNormal];
    [btnTimeStamptOut setTitle:@"Time Stamp Out" forState:UIControlStateNormal];
    [btnTimeStamptOut addTarget:self action:@selector(timeStampOutClicked:) forControlEvents:UIControlEventTouchUpInside];
    btnTimeStamptOut.backgroundColor = [UIColor whiteColor];
    [checkOutView addSubview:btnTimeStamptOut];

    self.modalView = [[RNBlurModalView alloc] initWithViewController:self view:checkOutView];
    [self.modalView show];

///dismiss the modal view

if([self.modalView isVisible]) { [self.modalView hide]; NSLog(@"modal view being hide"); }

Is there anything wrong in my code?

tyegah commented 10 years ago

Okay, I found out that setting the modalView to nil after dismissing it fixed the problem.