Reputation: 696
I have added 2 subviews into my view(EOPSessionsViewController), blurEffectView and reLogInView.
if (!UIAccessibilityIsReduceTransparencyEnabled()) {
self.view.backgroundColor = [UIColor clearColor];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
blurEffectView.tag = 123;
blurEffectView.frame = self.view.bounds;
blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:blurEffectView];
}else{
self.view.backgroundColor = [UIColor blackColor];
}
self.reLogInView = [[ReLoginViewController alloc]initWithNibName:@"ReLoginViewController" bundle:nil];
[self.view addSubview:self.reLogInView.view];
self.reLogInView.view.frame = CGRectMake(0, 0, self.view.frame.size.width/2, self.view.frame.size.height/2);
self.reLogInView.view.center = self.view.center;
self.reLogInView.view.backgroundColor = [UIColor grayColor];
self.reLogInView.view.layer.borderColor = [UIColor blackColor].CGColor;
self.reLogInView.view.layer.borderWidth = 3.0f;
I want to remove blurEffectView and reLogInView when user clicks a cancel button inside reLogInView. As of now, i can remove reLogInView with the code below.
- (IBAction)cancel:(id)sender {
[self.view removeFromSuperview];
}
My question is how to remove blurEffectView at the same time? Note that 3 of them are different classes.
Upvotes: 0
Views: 209
Reputation: 3025
Try adding something like this:
self.reLogInView.sessionsVC = self;
in the first code snippet. (declare it like this):
@interface ReLoginViewController : (???) <???>
...
@property (strong) EOPSessionsViewController *sessionsVC;
then:
- (IBAction)cancel:(id)sender {
[self.view removeFromSuperview];
[self.sessionsVC.blurEffectView removeFromSuperview];
}
Upvotes: 1