-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathViewController.m
46 lines (35 loc) · 1.08 KB
/
ViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// ViewController.m
// DeallocHelper
//
// Created by Pinka on 15-4-10.
// Copyright (c) 2015年 Pinka. All rights reserved.
//
#import "ViewController.h"
#import "DeallocHelper.h"
void *TestKey = &TestKey;
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *test1 = @"2";
[DeallocHelper attachToObject:test1 key:TestKey whenDeallocDoThis:^{
NSLog(@"test1 dealloc");
}];
NSString *test2 = [NSString stringWithFormat:@"%d", 2];
[DeallocHelper attachToObject:test2 key:TestKey whenDeallocDoThis:^{
NSLog(@"test2 dealloc");
}];
NSString *test3 = [NSString stringWithFormat:@"%d", 2];
[DeallocHelper attachToObject:test3 key:TestKey whenDeallocDoThis:^{
NSLog(@"test3 dealloc");
}];
[DeallocHelper dettachObject:test3 key:TestKey];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end