2015-10-04 195 views
0

我加入2子視圖到我的觀點(EOPSessionsViewController),blurEffectViewreLogInView刪除模糊搜索。從另一個子視圖

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; 

我想刪除blurEffectViewreLogInView當用戶點擊取消內部reLogInView按鈕。截至目前,我可以使用下面的代碼刪除reLogInView

- (IBAction)cancel:(id)sender { 

    [self.view removeFromSuperview]; 

} 

我的問題是如何在同一時間刪除blurEffectView?請注意,其中3個是不同的類。

回答

1

嘗試增加這樣的事情:

self.reLogInView.sessionsVC = self; 
第一代碼片段

。 (聲明它是這樣):

@interface ReLoginViewController : (???) <???> 
... 
@property (strong) EOPSessionsViewController *sessionsVC; 

然後:

- (IBAction)cancel:(id)sender { 
    [self.view removeFromSuperview]; 
    [self.sessionsVC.blurEffectView removeFromSuperview]; 
} 
相關問題