views:

58

answers:

2

How can i write a global method that can be called anywhere in my iPhone App Can any one Help Please.... Thanx and regards Balu.....

A: 

You would normally use the Singleton Class to contain global data and methods for your iphone application. Here are 2 good references: Singleton Tutorial, Singleton Pattern

ennuikiller
+2  A: 

You can write global functions (not part of a class) wherever you like. Just add the declaration where you use it (i.e. include a header file).

For example:

File globalfunctions.h

void doCoolStuff();

File globalfunctions.c

#include "globalfunctions.h"
void doCoolStuff()
{

}

and where you use it use

#include "globalfunctions.h" // or
#import "globalfunctions.h"
Eiko