Pages

Showing posts with label delegate. Show all posts
Showing posts with label delegate. Show all posts

June 12, 2013

Get App Delegate

Getting the App delegate in any iOS project is a common question for most of Objective-C developer. Of course you could use "[[UIApplication sharedApplication] delegate]" method, but I've wrap this code into a more readable function.


/** Returns the App Delegate.

 Usually you need casting the result, such as: MyClassAppDelegate *myAppDel = (MyClassAppDelegate*)[LMFunctions appDelegate];.

 @return Returns the generic object (id) representing the App Delegate.

 */
+ (id)appDelegate {
    return [[UIApplication sharedApplication] delegate];
}



Download the ready-for-use source file (.m) of Get App Delegate