Custom classes are an essential building block in Objective-C. Ultimately, all iOS apps are made up of objects that are instantiated from classes. Here is an example of how you can code classes in Objective-C.
Objective-C Custom Class Example Header File (MyClass.h)
#import <Foundation/Foundation.h> @interface MyClass : NSObject @property(strong) NSString *name; -(void)writeStateToLog; @end
Objective-C Custom Class Example Implementation File (MyClass.m)
#import "MyClass.h"
@implementation MyClass @synthesize name;
-(void)writeStateToLog{
NSLog(@"name = %@", self.name);
}
@end
Pretty simple huh?





Just came across this tutorial, I’m a newbie in iPhone app and like to try your tutorial, it will be great if you could please fix the link to the source code used in this tutorial, thank you!
Hi Summer,
Got it – the source code actually should be in the blog post. But, because we’ve recently moved this blog over from another platform some of the content fell through the cracks. I’ll be putting this post back on my list to revise right now.
Thank you Matt for fixing the link. Are you planning to post the Google map example you originally posted?
I don’t think so – I’m actually coming out with a really big Objective-C series that I think will be way more useful and I can’t find a copy of that code on my desktop
Me dull. You smart. That\’s just what I nedeed.