Global Classes

The best way to create a global class is to create a Singleton Instance.  The Apple description of this is here. However Matt Gallagher has a great page on it here and this example is based on downloading his marco header file to simplify implementation. Create a class called AppMain as normal. Copy Matt’s SynthesizeSingleton.h […]

Read More

Creating An Initialisation Function

Create your own initialise function //************************************** //************************************** //********** CLASS INITIALISE ********** //************************************** //************************************** //Override the default init in case our class is created using init instead of our initialse funciton (no need to declare in .h file as we’re overriding a superclass method) – (id)init { return [self initMyInitFunctionName:@”” Value1:0]; } //Our new init function: […]

Read More

Creating A New Class

Create the new class Menu > File > New File > iPhone OS > Cocoa Touch> Objective-C class Subclass of: NSObject Name it with your class name Save it in a suitable directory within your project Setting Up The Class With Basic Properites Etc In the .h file #import <Foundation/Foundation.h> @interface MyClassName : NSObject //ClassName:SuperclassName […]

Read More

Classes General

Objects are defined in classes and therefore these two terms are often used interchangeably.  Each object is actually an instance of a class. Creating A Class Object NSMutableArray *arrayInstance = [[NSMutableArray alloc] init; ‘alloc’ allocates the memory for the object and ‘init’ initialises it. Instance Methods Sent to instances of the class (objects). Calling: //Simple […]

Read More