2014-10-21 6 views
2

В настоящее время я работаю над проектом с MapView, который представляет modalView, когда пользователь нажимает кнопку.удалить Модальный эффект размытия после отклонения модальный вид

modalView использует типичный эффект размывания IOS, 8.

проблемы, я могу представить ModelView с эффектом размытия, и может отклонить это, но я не могу удалить эффект размытия карты.

Текущий код:

ViewController.m

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
    NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; 
    if ([buttonTitle isEqualToString:@"Set a alarm"]) { 

     [self blurEffectMethod]; 

     AlarmViewController *modal = [self.storyboard instantiateViewControllerWithIdentifier:@"setAlarm"]; 
     modal.transitioningDelegate = self; 
     modal.modalPresentationStyle = UIModalPresentationOverCurrentContext; 
     [self presentViewController:modal animated:YES completion:nil] 

-(void)blurEffectMethod { 
    UIVisualEffect *blurEffect; 
    blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; 
    UIVisualEffectView *visualEffectView; 

    if (_radiusSlider.hidden == NO) { 
     visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; 
     visualEffectView.frame = _mapView.bounds; 
     [_mapView addSubview:visualEffectView]; 
     //Hide Bars & Slider 
     [self.navigationController setNavigationBarHidden:YES animated:YES]; 
     [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; 
     _toolBar.hidden = YES ; 
     _radiusSlider.hidden= YES; 
     _sliderIndicator.hidden = YES; 
    } 

} 

ModelViewController.m

- (IBAction)dismisModal:(id)sender { 
    [_audioPlayer stop]; 
    [self dismissViewControllerAnimated:YES completion:nil]; 
} 

Как удалить размытия подвид из MAPview в то время как уволить modalView?

ответ

1

Вот как мне удается заставить мое модальное размытие работать!

let vc = UIViewController() 
vc.view = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) 
vc.modalPresentationStyle = .OverFullScreen 

let nc = UINavigationController(rootViewController: vc) 
nc.modalPresentationStyle = .OverFullScreen 

presentViewController(nc, animated: true, completion: nil) 

Здесь я использую флаг .OverFullScreen на prepareForSegue. И на мой взглядКонтроллеры размываются UIVisualEffectView

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 
    // Get the new view controller using segue.destinationViewController. 
    // Pass the selected object to the new view controller. 
    if segue.identifier == "LifeEventSegue" { 
     if let nc = segue.destinationViewController as? UINavigationController { 
      nc.modalPresentationStyle = .OverFullScreen 
      if let vi = nc.viewControllers.first as? UIViewController { 
       vi.modalPresentationStyle = .OverFullScreen 
      } 
     } 
    } 
} 
Смежные вопросы