In order to change a label with code, you have to connect it to a variable in your code. This video shows how to connect a user interface object to your code, and how to use code to modify it.
- [Instructor] So let's say you wanted…to change the text in the label with code.…The first step is to connect the label to your code.…To do that, one of my favorite ways is…to use the assistant editor, that's the button…we talked about in a previous movie…that allows you to see two views…in the editor at the same time.…Let's go back to the standard editor.…I want to show you a shortcut…to opening up the assistant editor.…To get some more space, I'm going…to hide the inspector area.…
And then I'm going to Option-click ViewController.swift.…What that does is it opens up the assistant editor,…placing the current selected file on the left side,…and then the Option-clicked file on the right side.…I'm going to hide the document outline…to get a little bit more space,…and then make sure I can see my label right here.…And then I want to make sure I can see my code as well.…So what we do is we drag this label into the code…and Xcode makes that a code object…that we can manipulate with code.…
To do that, right-click and drag…
- Installing and using Xcode
- Working with storyboards
- Working with UI objects and events
- Resizing objects and layouts dynamically
- Coding UI objects such as buttons
- Loading and displaying data in table views
- Testing your iOS app
Skill Level Beginner
1. Xcode Fundamentals
2. Core Skills
3. Responsive UI Design
4. Coding UI Objects
5. Table Views
6. App Flow and Testing
Next steps1m 8s
- 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.