ios - Blur view controller while presenting Uialertview -


i want make button press pop uialertview. know if it's possible blur around uialertview put blur effect on view controller. i've spent 2 hours finding solutions nothing works expected. wanna same thing on picture

uialertview blur background

you need use uiblureffect , uivisualeffectview here how code should looks like:

- (ibaction)buttonclicked:(id)sender {      // create blur effect     uiblureffect *blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight];      // add effect effect view     uivisualeffectview *visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect];     visualeffectview.frame = self.view.frame;       self.alertcontroller = [uialertcontroller alertcontrollerwithtitle: @"alert"                                                            message: nil                                                     preferredstyle: uialertcontrollerstylealert];       [self.alertcontroller addaction:[uialertaction actionwithtitle: @"cancel" style: uialertactionstylecancel handler:^(uialertaction *action) {         [visualeffectview removefromsuperview];      }]];       [self.view addsubview:visualeffectview];      [self presentviewcontroller: self.alertcontroller animated: true  completion: nil];  } 

uivisualeffectview class reference

result:

uivisualeffectview


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -