uchicago-mobi / 2016-Winter-Forum

Class Forum for MPCS51030.
3 stars 0 forks source link

Present Safari View Controller Modally instead of Push #116

Closed aaizuss closed 8 years ago

aaizuss commented 8 years ago

I implemented SFSafariViewController, but the view controller opens with a sliding (push?) animation (the kind of animation used when transitioning between a table view cell and the detail page, for example) instead of modally. The tutorials I've looked at and the Apple Developer video show a modal transition as the default, so I don't understand why mine isn't. I've read through this documentation and tried to manually change the animation style using svc.modalPresentationStyle (svn is what I called the view controller), but I haven't gotten that to work...

tabinks commented 8 years ago

Check in the Storyboard how the Segue "Kind" is set. You can toggle between modal and push here.

screenshot 2016-02-06 08 34 21
aaizuss commented 8 years ago

@tabinks I already tried that but I didn't actually use a segue... I just used a Bar Button Item action so that option isn't available.

screen shot 2016-02-06 at 9 22 48 am

I'll see if I can figure out how to make the button a segue instead of an action. The only way I know how to make a segue right now is ctrl + dragging from one view controller to another, but I don't actually have a view controller in storyboard for the safari view controller (I just have the DetailViewController).

tabinks commented 8 years ago

I can't seem to not have it present as modal. If you haven't resolved it, we can review it tomorrow.

prazgaitis commented 8 years ago

Before calling

self.presentViewController(safariViewController, animated: true, completion: nil)

add this line:

safariViewController.modalPresentationStyle = UIModalPresentationStyle.Popover

aaizuss commented 8 years ago

@prazgaitis That fixed it! Thank you!