| @@ -0,0 +1,73 @@ | ||
| // | ||
| // ChapThreeAppDelegate.m | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 __MyCompanyName__. All rights reserved. | ||
| // | ||
|
|
||
| #import "ChapThreeAppDelegate.h" | ||
|
|
||
| #import "ChapThreeViewController.h" | ||
|
|
||
| @implementation ChapThreeAppDelegate | ||
|
|
||
| @synthesize window = _window; | ||
| @synthesize viewController = _viewController; | ||
|
|
||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
| { | ||
| // Override point for customization after application launch. | ||
|
|
||
| self.window.rootViewController = self.viewController; | ||
| [self.window makeKeyAndVisible]; | ||
| return YES; | ||
| } | ||
|
|
||
| - (void)applicationWillResignActive:(UIApplication *)application | ||
| { | ||
| /* | ||
| Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
| Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
| */ | ||
| } | ||
|
|
||
| - (void)applicationDidEnterBackground:(UIApplication *)application | ||
| { | ||
| /* | ||
| Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
| If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
| */ | ||
| } | ||
|
|
||
| - (void)applicationWillEnterForeground:(UIApplication *)application | ||
| { | ||
| /* | ||
| Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
| */ | ||
| } | ||
|
|
||
| - (void)applicationDidBecomeActive:(UIApplication *)application | ||
| { | ||
| /* | ||
| Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
| */ | ||
| } | ||
|
|
||
| - (void)applicationWillTerminate:(UIApplication *)application | ||
| { | ||
| /* | ||
| Called when the application is about to terminate. | ||
| Save data if appropriate. | ||
| See also applicationDidEnterBackground:. | ||
| */ | ||
| } | ||
|
|
||
| - (void)dealloc | ||
| { | ||
| [_window release]; | ||
| [_viewController release]; | ||
| [super dealloc]; | ||
| } | ||
|
|
||
| @end |
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // ChapThreeViewController.h | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 __MyCompanyName__. All rights reserved. | ||
| // | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| @interface ChapThreeViewController : UIViewController | ||
|
|
||
| @end |
| @@ -0,0 +1,44 @@ | ||
| // | ||
| // ChapThreeViewController.m | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 __MyCompanyName__. All rights reserved. | ||
| // | ||
|
|
||
| #import "ChapThreeViewController.h" | ||
|
|
||
| @implementation ChapThreeViewController | ||
|
|
||
| - (void)didReceiveMemoryWarning | ||
| { | ||
| // Releases the view if it doesn't have a superview. | ||
| [super didReceiveMemoryWarning]; | ||
|
|
||
| // Release any cached data, images, etc that aren't in use. | ||
| } | ||
|
|
||
| #pragma mark - View lifecycle | ||
|
|
||
| /* | ||
| // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | ||
| - (void)viewDidLoad | ||
| { | ||
| [super viewDidLoad]; | ||
| } | ||
| */ | ||
|
|
||
| - (void)viewDidUnload | ||
| { | ||
| [super viewDidUnload]; | ||
| // Release any retained subviews of the main view. | ||
| // e.g. self.myOutlet = nil; | ||
| } | ||
|
|
||
| - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | ||
| { | ||
| // Return YES for supported orientations | ||
| return YES; | ||
| } | ||
|
|
||
| @end |
| @@ -0,0 +1,2 @@ | ||
| /* Localized versions of Info.plist keys */ | ||
|
|
| @@ -0,0 +1,31 @@ | ||
| // | ||
| // main.m | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 http://leniel.net. All rights reserved. | ||
| // | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
| #import "Simple.h" | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
|
|
||
| Simple *mySimple = [[Simple alloc] init]; | ||
|
|
||
| NSLog(@"retainCount: %d", [mySimple retainCount]); | ||
|
|
||
| [mySimple sayHello:@"Leniel"]; | ||
|
|
||
| [mySimple release]; | ||
|
|
||
| [Simple sayGoodBye]; | ||
|
|
||
| int retVal = UIApplicationMain(argc, argv, nil, nil); | ||
|
|
||
| [pool release]; | ||
|
|
||
| return retVal; | ||
| } |
| @@ -0,0 +1,17 @@ | ||
| // | ||
| // Simple.h | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 __MyCompanyName__. All rights reserved. | ||
| // | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @interface Simple : NSObject | ||
|
|
||
| -(void) sayHello: (NSString*) name; | ||
|
|
||
| +(void) sayGoodBye; | ||
|
|
||
| @end |
| @@ -0,0 +1,56 @@ | ||
| // | ||
| // Simple.m | ||
| // ChapThree | ||
| // | ||
| // Created by Leniel Macaferi on 8/29/11. | ||
| // Copyright 2011 __MyCompanyName__. All rights reserved. | ||
| // | ||
|
|
||
| #import "Simple.h" | ||
|
|
||
| @implementation Simple | ||
|
|
||
| - (id)init | ||
| { | ||
| self = [super init]; | ||
| if (self) { | ||
| // Initialization code here. | ||
| } | ||
|
|
||
| return self; | ||
| } | ||
|
|
||
| -(void) sayHello: (NSString*) name { | ||
| NSMutableString *message = [[NSMutableString alloc] | ||
| initWithString:@"Hello there "]; | ||
| [message appendString:name]; | ||
| NSLog(message); | ||
| [message release]; | ||
| } | ||
|
|
||
| +(void) sayGoodBye | ||
| { | ||
| NSLog(@"Goodbye..."); | ||
| } | ||
|
|
||
| +(id) alloc { | ||
| NSLog(@"allocating Simple..."); | ||
| return [super alloc]; | ||
| } | ||
|
|
||
| -(void) dealloc { | ||
| NSLog(@"deallocating Simple..."); | ||
| [super dealloc]; | ||
| } | ||
|
|
||
| -(id) retain { | ||
| NSLog(@"retaining Simple..."); | ||
| return [super retain]; | ||
| } | ||
|
|
||
| -(void) release { | ||
| NSLog(@"releasing Simple..."); | ||
| [super release]; | ||
| } | ||
|
|
||
| @end |