This is part of an ELC Tech Network

Objective C 2.0: An Intro – Part 2

Introduction

Hello everyone, welcome to my fourth screeencast. This is the second in my series introducing readers to Objective C. Let’s dive in.

Skill Level Beginner

Source Code

Available Here

Screencast

I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look through the slides and text if that suites you better.

iCodeBlog Tutorial: Objective C 2.0 An Intro Part 2 from Collin Ruffenach on Vimeo.

Tutorial

objectivec20anintropt2001

objectivec20anintropt2002

objectivec20anintropt2003

objectivec20anintropt2004

objectivec20anintropt2005

objectivec20anintropt2006

objectivec20anintropt2007

objectivec20anintropt2008

objectivec20anintropt2009

objectivec20anintropt2010

objectivec20anintropt2011

objectivec20anintropt2012

iCodeBlogClass.m:

@implementation iCodeBlogClass

@synthesize name;

-init
{
	return self;
}

@end

objectivec20anintropt2013

objectivec20anintropt2014

objectivec20anintropt2015

iCodeBlogGetsClassy.h:

#import "iCodeBlogClass.h"

objectivec20anintropt2016

objectivec20anintropt2013

objectivec20anintropt2014

objectivec20anintropt2015

iCodeBlogGetsClassy.h:

iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] init];
NSLog(@"%@", myNewObject);

objectivec20anintropt2017

objectivec20anintropt2018

objectivec20anintropt2019

objectivec20anintropt2020

objectivec20anintropt2021

objectivec20anintropt2020

Advertisement

objectivec20anintropt2023

objectivec20anintropt2024

iCodeBlogClass.h:

#import <Foundation/Foundation.h>

@interface iCodeBlogClass : NSObject
{
	NSString *name;
}

@property (nonatomic, retain) NSString *name;

@end

objectivec20anintropt2025

iCodeBlogClass.m:

@synthesize name;

objectivec20anintropt2026

objectivec20anintropt2027

iCodeBlogGetsClassy.m:

iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] init];
[myNewObject setName:@"Collin"];

NSLog(@"%@", [myNewObject name]);

objectivec20anintropt2028

objectivec20anintropt2029

objectivec20anintropt2030

iCodeBlogClass.m:

-initWithName:(NSString *)inputName
{
     self.name = inputName;
     return self;
}

objectivec20anintropt2031

objectivec20anintropt2032

iCodeBlogGetsClassy.m:

iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] initWithName:@"Collin"];

objectivec20anintropt2033

objectivec20anintropt2034

objectivec20anintropt2035

objectivec20anintropt2036

objectivec20anintropt2037

objectivec20anintropt2038

objectivec20anintropt2039

iCodeBlogGetsClassy.m:

iCodeBlogClass *person1 = [[iCodeBlogClass alloc] initWithName:@"Collin"];

objectivec20anintropt2040

iCodeBlogGetsClassy.m:

	iCodeBlogClass *person1 = [[iCodeBlogClass alloc] initWithName:@"Collin"];
	iCodeBlogClass *person2 = [[iCodeBlogClass alloc] initWithName:@"Martin"];
	iCodeBlogClass *person3 = [[iCodeBlogClass alloc] initWithName:@"vtsib"];
	iCodeBlogClass *person4 = [[iCodeBlogClass alloc] initWithName:@"AppStoreMod"];
	iCodeBlogClass *person5 = [[iCodeBlogClass alloc] initWithName:@"Matt"];
	iCodeBlogClass *person6 = [[iCodeBlogClass alloc] initWithName:@"Brendan"];
	iCodeBlogClass *person7 = [[iCodeBlogClass alloc] initWithName:@"Geoff"];
	iCodeBlogClass *person8 = [[iCodeBlogClass alloc] initWithName:@"RobotGrrl"];
	iCodeBlogClass *person9 = [[iCodeBlogClass alloc] initWithName:@"brandon"];
	iCodeBlogClass *person10 = [[iCodeBlogClass alloc] initWithName:@"Aaron"];
	iCodeBlogClass *person11 = [[iCodeBlogClass alloc] initWithName:@"Brian"];
	iCodeBlogClass *person12 = [[iCodeBlogClass alloc] initWithName:@"Fernando"];
	iCodeBlogClass *person13 = [[iCodeBlogClass alloc] initWithName:@"Chad"];

objectivec20anintropt2041

iCodeBlogGetsClassy.m:

NSMutableArray *myArray = [[NSMutableArray alloc] init];

objectivec20anintropt2042

iCodeBlogGetsClassy.m:

	[myArray addObject:person1];
	[myArray addObject:person2];
	[myArray addObject:person3];
	[myArray addObject:person4];
	[myArray addObject:person5];
	[myArray addObject:person6];
	[myArray addObject:person7];
	[myArray addObject:person8];
	[myArray addObject:person9];
	[myArray addObject:person10];
	[myArray addObject:person11];
	[myArray addObject:person12];
	[myArray addObject:person13];

objectivec20anintropt2043

objectivec20anintropt2044

objectivec20anintropt2045

iCodeBlogGetsClassy.m:

	for(iCodeBlogClass *myObject in myArray)
	{
		NSLog(@"%@", myObject);
	}

objectivec20anintropt2046

objectivec20anintropt2047

objectivec20anintropt2048

iCodeBlogGetsClassy.m:

-(NSString *)description
{
	return [NSString stringWithFormat:@"The name of the object is %@", self.name];
}
objectivec20anintropt2049
This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

23 Comments

  1. Locationc
    Posted June 30, 2009 at 8:16 am | Permalink

    really cool !
    I learned a lot of from it.
    Hope can see more about it!!

  2. Chris
    Posted June 30, 2009 at 2:44 pm | Permalink

    I love this series. You make it very easy to follow, I have been looking for something like this for some time.

    Keep up the good work.

  3. Posted June 30, 2009 at 4:30 pm | Permalink

    I tried to download the source code but need the user name and id to download. thanks.
    Linda Miller, DVM

  4. Posted June 30, 2009 at 4:31 pm | Permalink

    Don’t know if the last request went through.

    I am requesting a user name and password to download the source code.

    Thank you
    Linda Miller

  5. Posted June 30, 2009 at 4:51 pm | Permalink

    Linda,

    Sorry about that. No username or password required. I simply left FTP on the URL. It should be working now. Thanks for reading!

  6. Posted July 1, 2009 at 10:16 am | Permalink

    LOL I was in the video. Also great tutorial man that was awesome.

  7. Posted July 1, 2009 at 2:05 pm | Permalink

    Really great tutorial! I’ve been working with xcode quite a while now, but your tutorial made some thins even clearer! Thank you!!!

  8. Jimmy Liu
    Posted July 2, 2009 at 3:39 am | Permalink

    Thanks for tutorial, It’s great to me, keep going man.

  9. Maiquer
    Posted July 2, 2009 at 8:26 am | Permalink

    I’ve recently discovered this blog while I was looking for iPhone coding and Obj-C tips. All I can say is Thank You for these excellent tutorials. They are helping me a lot.

    Clear explanations and very nice presentation. Just perfect.

    Thanks a lot.

  10. Fernando
    Posted July 6, 2009 at 11:44 pm | Permalink

    Just heard my name in the tutorial while i was walking around and listening to it and almost started laughing :) Thanks for the credits.

    Very good tutorial, believe it or not that tip about the documentation and how to properly use and read it is about the most helpful tip I have come across since I have started dealing with iPhone programming.

    Great work with the videos and on providing the code. There are very few quality sites like this, and this has given me a strong foundation to objective-c/iphone programming that countless books and apple pdfs could not. Can’t wait for the next part in the series.

  11. Posted July 7, 2009 at 6:29 am | Permalink

    Great work Collin… I totally understood and ‘synthesized’ that lesson (man, that was a geeky play on words). But seriously, You have a great speaking cadence, and keep the listener engaged.

    Really looking forward to future editions. Now program yourself a damn donate button and at least let a few of us buy you some beers!

    best,
    B.

  12. Posted July 7, 2009 at 9:59 pm | Permalink

    That was an excellent tutorial! The keynote presentation was very well done and extremely polished. Keep up the good work man. I’m looking forward to your next one.

  13. Posted July 8, 2009 at 9:06 pm | Permalink

    Hmmm – I’m getting a ‘page not found’ error when I try to d/l the source code.

    Thanks for another great tutorial!

  14. Aaron
    Posted July 9, 2009 at 8:26 pm | Permalink

    This is fantastic, I was hoping you could also repost the first screencast since it seems to be down? Thank you!

  15. Posted July 10, 2009 at 11:04 am | Permalink

    Thanks for the beginner’s guides! These are really making my foray into the iPhone development world alot more enjoyable (and more comprehensive).

  16. rice
    Posted July 11, 2009 at 7:06 pm | Permalink

    Thank you for these screen casts! They have really helped to explain the usage of cocoa. Could you possibly post number 1 on vimeo, too?

  17. Josso
    Posted July 23, 2009 at 10:34 am | Permalink

    When does part 3 come?

  18. Posted July 25, 2009 at 9:31 am | Permalink

    Very useful tutorial ! I’m really looking forward the next ones :)

  19. Posted July 25, 2009 at 4:23 pm | Permalink

    These are better than the stanford class videos.

    Please assign them a category (screencast or something) so they are easy to find on the blog.

    looking forward to the next one

    thanks

  20. Vince
    Posted August 6, 2009 at 3:26 am | Permalink

    I had trouble in part 1 for a few minutes because I didn’t realize that xcode was case sensitive. For example, NSString is not the same as nsstring to the xcode compiler.

    I have watched part 1 and I am just starting part 2. Perhaps you’ll cover that here. :)

  21. Vince
    Posted August 6, 2009 at 4:16 am | Permalink

    I assume that at some point you cover variable allocation and DEallocation. Great tutorials so far!

  22. Posted August 19, 2009 at 11:06 am | Permalink

    Cool piece here. Learned a lot from it. You see, this should be the approach for starters. Doing a new language means being oriented with the basics like reserve words, pre-defined methods, etc… The moment you’re familiar already with the terms, and you can pitch in your stock knowledge, then it wouldn’t be a hard thing for you to move on and feel comfortable with it.

  23. Michael Kork
    Posted April 12, 2010 at 4:17 pm | Permalink

    Great tutorial.. I have some general questions.
    What is the difference between @class and @implementation.. When do we need one of them or both.. I’m confused..

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">