ios - Presenting transparent view controller over another -
i trying present view controller on one, upper transparent , , bottom have blur effect.
what happened see black background in presented view, although clear colour.
i have read here, , did same : display clearcolor uiviewcontroller on uiviewcontroller
//to present pillview *pillv=[[pillview alloc]initwithpill:pill withnum:num]; pillv.delegate=self; uivisualeffect *blureffect; blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight]; uivisualeffectview *visualeffectview; visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect]; visualeffectview.frame=cgrectmake(0, 0, self.view.frame.size.width, [globals sharedglobals].titleheight*self.view.frame.size.height); [self.view addsubview:visualeffectview]; self.modalpresentationstyle = uimodalpresentationcurrentcontext; [self presentviewcontroller:pillv animated:no completion:nil];
you need add uivisualeffectview
presented view controller, , not 1 doing presentation.
pillview *pillv=[[pillview alloc]initwithpill:pill withnum:num]; pillv.delegate=self; uivisualeffect *blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight]; uivisualeffectview *visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect]; visualeffectview.frame= pillv.view.bounds; pillv.view.backgroundcolor = [uicolor clearcolor]; [pillv.view insertsubview:visualeffectview atindex:0]; self.modalpresentationstyle = uimodalpresentationovercurrentcontext; [self presentviewcontroller:pillv animated:no completion:nil];
and because op seems thinking solution not working, here sample project show this:
https://dl.dropboxusercontent.com/u/29456419/blurtest.zip
and here pictures of view (presenting) , overlayview:
Comments
Post a Comment