Switches toggle on and off, and activity indicators show that a task is being completed. See how to create and customize these controls in this video.
- [Instructor] A switch is a simple UI control…that has an on and an off state.…You can create a switch through the library.…Filter for switch…and then drag one onto the screen wherever you'd like.…Let's also filter for a label.…We can drag one below the switch.…That should be good.…Let's connect these objects to code…by opening up the assistant editor,…which we can do by Option + clicking ViewController.swift,…and then right click and drag from the label…underneath your view controller class declaration.…
Call it label.…Hit Connect or Enter.…I'll make an extra line of space.…And then right click and drag from the switch…underneath viewDidLoad.…Now you may recognize the value changed event.…This works just like the slider controller…and many of the other user interface objects in Xcode.…Now I'm not going to show you all of them…because many of them work in the same way.…I just want to point out that for the most part,…this is the process.…
The UI object has some kind of event that it can trigger.…You could handle that event…
- Alert controllers and actions
- Sliders, progress bars, and switches
- Creating UI elements with code
- Displaying web content with Safari view controllers and WKWebView
- Creating collection view controllers
- Creating tabbed apps
- Publishing your app with App Store Connect
Skill Level Beginner
1. Master Views
2. Display Web Content
3. Collection Views
4. Multiview Templates
Customize a table view cell4m 18s
5. Publish an App
Next steps3m 28s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.