Pages

Saturday, August 14, 2010

Iphone: How To Create Global AppDel Objec

How To Create Global AppDel Object.

Actually, When we working on Iphone Application Most of time we need to create AppDelegate Object to access the functions or Variables.
So instead of creating each time a new object of AppDel,we can create only single time and use directly to any view of Application.
we can do this as follows:

1) Define Obj in .pch file such as

YourAppDelegate *AppDel;

2) Alloc Memory to Obj in AppDel Class in applicationDidFinishLaunching:(UIApplication *)application function
such as AppDel = (YourAppDelegate *) [[UIApplication sharedApplication] delegate];

No comments:

Post a Comment