alexhillc / AXPhotoViewer

An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.
https://www.cocoacontrols.com/controls/axphotoviewer
MIT License
646 stars 119 forks source link

Present over current context #3

Closed Daman1208 closed 7 years ago

Daman1208 commented 7 years ago

I am trying to present PhotosViewController over current context like this:

                photosViewController.modalPresentationStyle = .overCurrentContext
                photosViewController.modalTransitionStyle = .crossDissolve

But after dismissing, blank white screen is shown.

In this function

@objc public func closeAction(_ sender: UIBarButtonItem) {
        self.isForcingNonInteractiveDismissal = true
        self.presentingViewController?.dismiss(animated: true)
    }

self.presentingViewController is returning parent view controller rather than the top view controller I am presenting on. I don't have image view objects as I am showing images in textView as attachments, so I need to present with animation like cross dessolve.

alexhillc commented 7 years ago

Hi @Daman1208, is there a particular reason you wanted to present over the current context? Seems like the same goal could be achieved by just setting the modal transition style:

let photosViewController = PhotosViewController(dataSource: someDataSource)
photosViewController.modalTransitionStyle = .crossDissolve
self.present(photosViewController, animated: true)

In any case, however, I do agree that this is something that might be desired in the future, so I've added support for all modal presentation styles in the latest release.

Daman1208 commented 7 years ago

Just setting the modal transition style worked. Thanks.