Join Todd Perkins for an in-depth discussion in this video Solution: Create two variables, part of Programming for Non-Programmers: iOS 7.
- View Offline
…There are multiple ways you could have approached this challenge.…And as long as you arrive at the…correct solution, any method you use can be correct.…Here is the method that I used.…In mainstoryboard.storyboard, I made sure that my utility view was showing,…and then I clicked and dragged two labels onto the screen.…So, there is one.…And there is another label.…Then, I created two variables, one for each label.…
I did that in ViewController.h.…At the end of line 11, I will go to…the next line, create an open curly brace and type enter.…And now I'm going to create an IBOutlet that is a UI label called name.…At this point, we need two different UI labels.…I'm going to show you a short cut to doing that.…One way is, we can select this line and copy with Cmd+C.…Go to the next line, paste the code with Cmd+V, and change name to age.…
But since there are two variables that are…the same data type, that is IBOutlet, UILabel.…We actually have a short cut.…I'll show you how to do that.…Going to delete that line of code.…
If you find you'd like to learn more, see iOS App Development Essential Training, Foundations of Programming: Fundamentals, or any of the other programming courses in our library.
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding functions, methods, and selectors
- Connecting a button to a function
- Using conditional statements
- Setting up the user interface
- Connecting code elements to build an app