RSS

iOS Newbie Part 1 – Getting Started

28 Jun


iOS is the operating system used by iPhones, iPads and iPod Touch devices.  If you want to create iOS apps you’re going to have to learn Objective-C, which is Apples object-oriented version of C.  The hardest part for me when I started learning Objective-C was sorting through the information available.  How was I to know where to focus? What could I defer for now and learn later?  You can only learn so much stuff at once.

My tutorials are going to focus on creating a re-usable template for creating a game.  This game will have chapter and level selection much like Angry Birds or Cut the Rope.  You know the ones, you unlock levels and earn stars.  Time to learn to walk before we can crawl.

To get started you will need:

Xcode is the development suite used to create iOS applications, or in other words, a text-editor and app content manager on steroids.  Once you’re signed up as an Apple iOS Developer you will be able to download Xcode from the Member Center.  The current version of Xcode is version 4.  Version 3 is so last year.

Time for some quick theory work before we dive into the practical.

What are Classes?

Classes are reusable pieces of code that perform a specific function.  In Objective-C a class is split into two files.  A header file which has a file extension of .h and an implementation file with a file extension of .m.  The reason for the split is to simplify how you use an existing class.  You don’t necessarily need to know how a class does something, you just need to know how to ask it to do something.  This means that when using an existing class you will look at the .h file and study the interface to determine how to use it.

What are Frameworks?

Collections of classes are generally referred to as Frameworks.  Cocos2d is a framework with classes useful for games in particular.  As I mentioned before we’re going to create a template that can be re-used as a starting point for a game, so we’re going to use Cocos2d.  To create games you don’t normally use the Interface Builder supplied with Xcode, so I won’t cover its usage.  Instead the programming is done by hand.  Go ahead and download the latest unstable version of cocos2d-iphone, by the time you release your game it’ll probably be the stable version!

Sweet.  Now you’ve got Xcode, a Cocos2d tar.gz file and no idea what to do next.

Now What?

You don’t need to install Cocos2d, it’s just a bunch of class files you can literally copy and paste into the same directoy of your iOS app.  It is however much preferred if you can at least install the Xcode templates to make your life easier.  I won’t cover this as the tutorial to install those templates exists here, section 3 shows you how.

At this point I’m assuming you have your cocos2d templates installed.  If you do, create a new project in Xcode (File > New > Project) and select the cocos2d_box2d template.  If you didn’t manage to get that far don’t worry, just download and extract this file I’ve prepared earlier.  Double click Testing.xcodeproj and you’re up to speed.

How to run an app in the iPad or iPhone simulator

In the top left of Xcode you have a play button, stop button and target device drop down. If you press play and it doesn’t work it’s likely that the project has a different deployment target than you have installed.  For example I’m using iOS5 and your Xcode might only have up to 4.3.  You will need to select the blue (top left) top level Testing project then change the deployment target version to 4.3 before it will work.

Hopefully now you’re at a point where you can see text in the  iOS simulator saying ‘Tap Screen’, try it.

That’s enough for part 1, stay tuned for the continuation where I’ll take you on a closer tour of Xcode.

If you liked this tutorial or found something wrong with it please let me know!

If you want to support my work and have an iPad please consider purchasing iSoccer *wink*

-Tim

Go to Part 2 or visit Tutorials Index


Be Sociable, Share!
     

    About Tim Roadley

    I'm a senior analytics software consultant at eMite Pty Ltd primarily focused on delivering business intelligence dashboards, currently for one of Australia’s major banks. I'm also working on a revamped version of eMite's iOS App for release under iOS 7. Prior to eMite, I was Infrastructure Manager at Cuscal Pty Ltd where I was heavily involved in designing and implementing a payments switch that drives 1300+ ATM’s Australia wide. I have several apps on the App Store, including Teamwork, iSoccer and now Grocery Dude and Grocery Cloud. In my down time I enjoy spending time with my wonderful wife Tracey and two lovely children Tyler and Taliah.
    18 Comments

    Posted by on June 28, 2011 in iOS Tutorials

     

    18 Responses to iOS Newbie Part 1 – Getting Started

    1. Rick OSullivan

      June 5, 2012 at 5:34 pm

      Hey Tim,
      Nicely done. Even I can understand what your talking about!.
      LOL

       
    2. minase

      June 26, 2012 at 11:56 am

      Thanks For you Posting.

       
    3. Ed

      September 17, 2012 at 11:25 am

      I’m downloading Xcode 3.2.6 (still on Snow Leopard on my 2006 MacBook) as I type this. Are your tutorials good for those like me who have no programming experience at all but want to learn?

       

    Leave a Reply