Subscribe ( RSS )

iPhone Programming Tutorials


 

Objective C 2.0: An Intro – Part 2

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

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

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
 

22 Responses

Locationc Says:

June 30th, 2009 at 8:16 am

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

Chris Says:

June 30th, 2009 at 2:44 pm

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.

Linda Says:

June 30th, 2009 at 4:30 pm

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

Linda Says:

June 30th, 2009 at 4:31 pm

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

Collin Says:

June 30th, 2009 at 4:51 pm

Linda,

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

AppStoreMod Says:

July 1st, 2009 at 10:16 am

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

kubi Says:

July 1st, 2009 at 2:05 pm

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

Jimmy Liu Says:

July 2nd, 2009 at 3:39 am

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

Maiquer Says:

July 2nd, 2009 at 8:26 am

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.

Fernando Says:

July 6th, 2009 at 11:44 pm

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.

Brendan G. Says:

July 7th, 2009 at 6:29 am

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.

Elbert Says:

July 7th, 2009 at 9:59 pm

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.

Lewis Says:

July 8th, 2009 at 9:06 pm

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

Thanks for another great tutorial!

Aaron Says:

July 9th, 2009 at 8:26 pm

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

LockeCole117 Says:

July 10th, 2009 at 11:04 am

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

rice Says:

July 11th, 2009 at 7:06 pm

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?

Josso Says:

July 23rd, 2009 at 10:34 am

When does part 3 come?

Maverick Says:

July 25th, 2009 at 9:31 am

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

layne Says:

July 25th, 2009 at 4:23 pm

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

Vince Says:

August 6th, 2009 at 3:26 am

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. :)

Vince Says:

August 6th, 2009 at 4:16 am

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

Kent Says:

August 19th, 2009 at 11:06 am

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.

Leave a Reply