ios - How to dismiss a popover only with a button in swift -


my ipad app has several data gathering popovers, , want able disable dismissal of popover touching outside of it, use button quit popover @ users discretion.

the app looks great, popovers work fine, , have button inside them quits nicely. can't find way of disabling dismissal in swift, lots of posts on obj-c nothing in swift.

does mean functionality no longer available?

i appreciate frustration.

simply set view controller's modalinpopover true , popover's passthroughviews nil. must latter using delayed performance or won't work. small delay that's needed. example:

    let vc = uiviewcontroller()     vc.modalpresentationstyle = .popover     self.presentviewcontroller(vc, animated: true, completion: nil)     if let pop = vc.popoverpresentationcontroller {         vc.modalinpopover = true         delay(0.1) {             pop.passthroughviews = nil         }     } 

for delay function, see dispatch_after - gcd in swift?.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -