ios - How to implement UIVisualEffectView in UITableView with adaptive segues -


i implement uivisualeffectview apply blur effect view show view lies behind it.

this view should have background blurred uitableviewcontroller embedded in uinavigationcontroller, , either presented in popover on ipad or presented full screen modally on iphone, ios 8 adaptive segues (present popover). when view controller in popover want background blur what's underneath popover, , when it's presented full screen want background blur previous view controller.

i have tried implement , have not been successful. cannot blur effect work popover. thought code should trick:

//in viewdidload on uitableviewcontroller subclass: let effectview = uivisualeffectview(effect: uiblureffect(style: .light)) effectview.frame = tableview.frame tableview.addsubview(effectview) 

i tried adding subview tableview.backgroundview, tried setting backgroundview effectview, tried using autolayout constraints instead of setting frame, nothing has worked. can me accomplish desired behavior?

an example of trying obtain:
ipad popover:
enter image description here

iphone modal presentation:
enter image description here

i've found solution. had create 2 separate segues - 1 popover presentation called on ipad, , other modal segue presentation style set on full screen (that's important) iphone.

in table view controller being presented, in viewdidload, code apply desired blur effect (and bonus, if haven't disabled transparency effects):

if (!uiaccessibilityisreducetransparencyenabled()) {     tableview.backgroundcolor = uicolor.clear     let blureffect = uiblureffect(style: .light)     let blureffectview = uivisualeffectview(effect: blureffect)     tableview.backgroundview = blureffectview      //if inside popover     if let popover = navigationcontroller?.popoverpresentationcontroller {         popover.backgroundcolor = uicolor.clear     }      //if want translucent vibrant table view separator lines     tableview.separatoreffect = uivibrancyeffect(blureffect: blureffect) } 

this causes table background appear in screenshots. trick iphone ensure it's presented on screen, while trick ipad remove backgroundcolor in popoverpresentationcontroller.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -