Sunday, 15 August 2010

xcode - How to present a modal atop the current view in Swift -



xcode - How to present a modal atop the current view in Swift -

(xcode6, ios8, swift, ipad)

i trying create classic web-like modal view, outside of dialog box "grayed-out." accomplish this, i've set alpha value of backgroundcolor of view modal 0.5, so:

self.view.backgroundcolor = uicolor.blackcolor().colorwithalphacomponent(0.5)

the problem when modal becomes full-screen, presenting view removed. (ref transparent modal view on navigation controller).

(a bit irritated @ concept here. why remove underlying view? modal is, definition, appear atop other content. 1 time underlying view removed, it's not modal anymore. it's somewhere between modal , force transition. wa wa wa... anyway..)

to prevent happening, i've set modalpresentationstyle currentcontext in viewdidload method of parent controller, , in storyboard... no luck.

self.modalpresentationstyle = uimodalpresentationstyle.currentcontext self.navigationcontroller.modalpresentationstyle = uimodalpresentationstyle.currentcontext

how prevent presenting view beingness removed when modal becomes total screen?

tyvm.. more info below.

also in storyboard, (presentation: current context)

thx help... documentation below:

i had same problem. worked me remove explicit setting of modal presentation style , 1 thing:

in storyboard set modalviewcontroller's modalpresentation style "over current context"

i checked checkboxes in root(presenting) viewcontroller - provide context , define context. seem working unchecked.

xcode ipad modal-dialog swift transparent

No comments:

Post a Comment