View difference between Paste ID: F8mtfpfP and ae8jQHTx
SHOW: | | - or go back to the newest paste.
1
- (void)viewDidLoad {
2
3
[NSTimer scheduledTimerWithTimeInterval:5.00
4
target:self
5
selector:@selector(targetMethod)
6
userInfo:nil
7
repeats:YES];
8
NSLog(@"myInt IN VIEW DIDLOAD:::::: %d", myInt);  
9
}
10
11
- (void)targetMethod {
12
iIncValue= iIncValue + 1;
13
/*if(a>4)
14
{
15
a=0;
16
}*/
17
18
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
19
[userDefaults setInteger:iIncValue forKey:@"iIncValue"];
20
[userDefaults synchronize];
21
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
22
myInt = [prefs integerForKey:@"iIncValue"];
23
24
CharsetViewController *oCharsetViewController = [[CharsetViewController alloc] initWithNibName:@"CharsetViewController" bundle:nil];
25
oCharsetViewController.myInt = iIncValue;
26
27
NSLog(@"MYINT value in target method ~~~~~~~~~~~ %d", myInt);
28
29
[self presentModalViewController:oCharsetViewController animated:YES];
30
[oCharsetViewController release];
31
}
32
33
34
35
OUTPUT:
36
37
38
2012-08-08 14:22:51.268 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 1
39
2012-08-08 14:22:51.274 Charset[2459:207] myInt IN VIEW DIDLOAD:::::: 1
40
2012-08-08 14:22:56.267 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 2
41
2012-08-08 14:22:56.274 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 1
42
2012-08-08 14:22:56.279 Charset[2459:207] myInt IN VIEW DIDLOAD:::::: 1
43
2012-08-08 14:23:01.267 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 3
44
2012-08-08 14:23:01.274 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 2
45
2012-08-08 14:23:01.279 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 1
46
2012-08-08 14:23:01.283 Charset[2459:207] myInt IN VIEW DIDLOAD:::::: 1
47
2012-08-08 14:23:06.267 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 4
48
2012-08-08 14:23:06.273 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 3
49
2012-08-08 14:23:06.278 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 2
50
2012-08-08 14:23:06.283 Charset[2459:207] MYINT value in target method ~~~~~~~~~~~ 1
51
2012-08-08 14:23:06.288 Charset[2459:207] myInt IN VIEW DIDLOAD:::::: 1