Skip to content

Commit bdd70f3

Browse files
committed
Added Lazy Sample
1 parent d253e97 commit bdd70f3

13 files changed

+1917
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// LazyStartSampleAppDelegate.h
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@class LazyStartSampleViewController;
12+
13+
@interface LazyStartSampleAppDelegate : NSObject <UIApplicationDelegate> {
14+
UIWindow *window;
15+
LazyStartSampleViewController *viewController;
16+
}
17+
18+
@property (nonatomic, retain) IBOutlet UIWindow *window;
19+
@property (nonatomic, retain) IBOutlet LazyStartSampleViewController *viewController;
20+
21+
@end
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// LazyStartSampleAppDelegate.m
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import "LazyStartSampleAppDelegate.h"
10+
#import "LazyStartSampleViewController.h"
11+
12+
@implementation LazyStartSampleAppDelegate
13+
14+
@synthesize window;
15+
@synthesize viewController;
16+
17+
18+
#pragma mark -
19+
#pragma mark Application lifecycle
20+
21+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
22+
23+
// Override point for customization after application launch.
24+
25+
// Add the view controller's view to the window and display.
26+
[self.window addSubview:viewController.view];
27+
[self.window makeKeyAndVisible];
28+
29+
/*
30+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
31+
[NSThread sleepForTimeInterval:25.0];
32+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
33+
*/
34+
return YES;
35+
}
36+
37+
38+
- (void)applicationWillResignActive:(UIApplication *)application {
39+
/*
40+
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.
41+
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.
42+
*/
43+
}
44+
45+
46+
- (void)applicationDidEnterBackground:(UIApplication *)application {
47+
/*
48+
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.
49+
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
50+
*/
51+
}
52+
53+
54+
- (void)applicationWillEnterForeground:(UIApplication *)application {
55+
/*
56+
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
57+
*/
58+
}
59+
60+
61+
- (void)applicationDidBecomeActive:(UIApplication *)application {
62+
63+
/*
64+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
65+
[NSThread sleepForTimeInterval:25.0];
66+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
67+
*/
68+
/*
69+
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.
70+
*/
71+
}
72+
73+
74+
- (void)applicationWillTerminate:(UIApplication *)application {
75+
/*
76+
Called when the application is about to terminate.
77+
See also applicationDidEnterBackground:.
78+
*/
79+
}
80+
81+
82+
#pragma mark -
83+
#pragma mark Memory management
84+
85+
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
86+
/*
87+
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
88+
*/
89+
}
90+
91+
92+
- (void)dealloc {
93+
[viewController release];
94+
[window release];
95+
[super dealloc];
96+
}
97+
98+
99+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// LazyStartSampleViewController.h
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface LazyStartSampleViewController : UIViewController {
12+
13+
}
14+
15+
-(IBAction)doit;
16+
17+
@end
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
//
2+
// LazyStartSampleViewController.m
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import "LazyStartSampleViewController.h"
10+
#import "SubViewController.h"
11+
12+
@implementation LazyStartSampleViewController
13+
14+
15+
16+
/*
17+
// The designated initializer. Override to perform setup that is required before the view is loaded.
18+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
19+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
20+
if (self) {
21+
// Custom initialization
22+
}
23+
return self;
24+
}
25+
*/
26+
27+
/*
28+
// Implement loadView to create a view hierarchy programmatically, without using a nib.
29+
- (void)loadView {
30+
}
31+
*/
32+
33+
34+
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
35+
- (void)viewDidLoad {
36+
[super viewDidLoad];
37+
/*
38+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
39+
[NSThread sleepForTimeInterval:25.0];
40+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
41+
*/
42+
}
43+
44+
- (void)viewWillAppear:(BOOL)animated
45+
{
46+
// NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
47+
// [NSThread sleepForTimeInterval:25.0];
48+
// NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
49+
50+
}
51+
-(IBAction)doit
52+
{
53+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
54+
[NSThread sleepForTimeInterval:25.0];
55+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
56+
}
57+
58+
59+
- (void)viewDidAppear:(BOOL)animated
60+
{
61+
// NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
62+
// [NSThread sleepForTimeInterval:25.0];
63+
// NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
64+
65+
66+
SubViewController* viewController = [[SubViewController alloc] init];
67+
[self presentModalViewController:viewController
68+
animated:YES];
69+
[viewController release];
70+
}
71+
72+
/*
73+
// Override to allow orientations other than the default portrait orientation.
74+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
75+
// Return YES for supported orientations
76+
return (interfaceOrientation == UIInterfaceOrientationPortrait);
77+
}
78+
*/
79+
80+
- (void)didReceiveMemoryWarning {
81+
// Releases the view if it doesn't have a superview.
82+
[super didReceiveMemoryWarning];
83+
84+
// Release any cached data, images, etc that aren't in use.
85+
}
86+
87+
- (void)viewDidUnload {
88+
// Release any retained subviews of the main view.
89+
// e.g. self.myOutlet = nil;
90+
}
91+
92+
93+
- (void)dealloc {
94+
[super dealloc];
95+
}
96+
97+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// SubViewController.h
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
12+
@interface SubViewController : UIViewController {
13+
14+
}
15+
16+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// SubViewController.m
3+
// LazyStartSample
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/11.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import "SubViewController.h"
10+
11+
12+
@implementation SubViewController
13+
14+
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
15+
/*
16+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
17+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
18+
if (self) {
19+
// Custom initialization.
20+
}
21+
return self;
22+
}
23+
*/
24+
25+
/*
26+
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
27+
- (void)viewDidLoad {
28+
[super viewDidLoad];
29+
}
30+
*/
31+
32+
/*
33+
// Override to allow orientations other than the default portrait orientation.
34+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
35+
// Return YES for supported orientations.
36+
return (interfaceOrientation == UIInterfaceOrientationPortrait);
37+
}
38+
*/
39+
40+
- (void)didReceiveMemoryWarning {
41+
// Releases the view if it doesn't have a superview.
42+
[super didReceiveMemoryWarning];
43+
44+
// Release any cached data, images, etc. that aren't in use.
45+
}
46+
47+
- (void)viewDidUnload {
48+
[super viewDidUnload];
49+
// Release any retained subviews of the main view.
50+
// e.g. self.myOutlet = nil;
51+
}
52+
53+
- (void)viewDidAppear:(BOOL)animated
54+
{
55+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"sleeping...");
56+
[NSThread sleepForTimeInterval:25.0];
57+
NSLog(@"%s|%@", __PRETTY_FUNCTION__, @"finished");
58+
59+
// NSLog(@"%s|%@", __PRETTY_FUNCTION__, [NSThread callStackSymbols]);
60+
}
61+
62+
- (void)dealloc {
63+
[super dealloc];
64+
}
65+
66+
67+
@end

0 commit comments

Comments
 (0)