Join Todd Perkins for an in-depth discussion in this video Connecting a button to a function, part of Programming for Non-Programmers with iOS 7.
…We've already looked at connecting a variable to a storyboard object.…Now, we'll look at connecting a function to a storyboard action.…Now, I use the word action instead of…object because we're not connecting a function to…a visual element, we're connecting a function to…something that happens when you click a button.…So let's look at how that works.…I'm in my ViewController.h file, and you can see I…have a label that is connected to a storyboard UILabel.…
Now, below the curly braces, I'm going to declare my function.…Now, this is very similar to declaring a variable in our .h file.…In that we're not going to declare what the function does.…We're just going to say the name of the function, and…the type of information that it returns and that it receives.…So, we'll type a hyphen and open…parenthesis, and then I'm going to type IBAction.…And as I type IBAction, you see that Xcode wants to finish this for me.…
So, I'm going to press a Return on my keyboard.…And now the code that's highlighted says, selector.…
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
Skill Level Beginner
1. Setting Up Your Coding Environment
Creating an Xcode project1m 55s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Functions
4. Programming Building Blocks: Conditional Statements
Using conditional statements5m 21s
5. Building Your First Full Application
- 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.