Development ideas, coding, tutorials, war stories, app reviews and everything between.
Thursday, May 10, 2012
Importing frameworks, classes Xcode 4.3.1
In this tutorial I'll be touching on importing frameworks, classes, header files. This will be a short tutorial, the concepts here are pretty simple but can be frustrating if you're new to the iOS development world.
Let's get started!
Fire up xcode and create a new project:
I named my project "HelloWorld", use whatever naming convention you'd like.
If you open up your HelloWorldViewController.h you will see at the top it's importing:
When the import statement is incased in left and right arrow brackets "< >"
it indicates it's a system file or framework being imported.
If the import statement looks like this:
It's importing a file that was created within your project, this is indicated by the quotation marks "classname.h"
Now that we know the difference between the two types of imports lets show you how to import some of the great built in frameworks Apple has provided to you.
Select your project from the top of your file list, select the tab labeled "Build Phases", find the drop down labeled "Link Binary With Libraries"
This view will show you the current frameworks your application is already using, you can add additional ones by clicking on the + button.
Select the framework you want from the list and click the add button.
Now you just need to use the import statements we learned about earlier to bind to this framework in your class file.
In your HelloWorld.h use the import statement
Thanks for reading, our next installment will cover creating classes.
Cheers,
Corey
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment