Safari view controllers have delegate methods to handle when a Safari URL opens, or when the Safari view controller closes and returns control to your application. See how it works in this tutorial.
- [Instructor] So let's say we want to handle…when the Safari view controller is dismissed.…You can do that through delegation.…The first step in delegation is to tell our class…that it can be a delegate for a Safari view controller.…So in my class declaration on Line 12,…right after UIViewController,…I'm going to type a comma and a space,…and then SFSafariViewControllerDelegate.…So you can hit that.…And then if you have questions…about which methods you can handle,…you can always click in there,…show quick help,…and look up the documentation.…
You probably want to look at protocol reference.…And you can see what methods you can adopt…and what they do.…The main one we're concerned with right now…is when that view controller is actually dismissed.…So let's hide the utility area,…scroll down,…and then beneath showWebContent,…we're going to handle the method by typing Safari out.…We can see the method by starting to type out Safari.…So in here you can see safariViewControllerDidFinish,…safariViewController initialLoadDidRedirectTo, etc.…
Instructor Todd Perkins shows how to use pickers, pop-up messages, sliders, switches, and indicators to build a sophisticated app interface, and display HTML content, files, and data with web views. Plus, learn how to dynamically update your layouts using size classes, and get a brief overview of the Apple Human Interface Guidelines.
- Picker views, controllers, sliders, and indicators
- Creating UI elements with code
- Displaying images with image views
- Creating web views to display web content
- Changing fonts, pins, and views with size classes