//
// ViewController.m
// __block__weak
//
// Created by apple on 15/12/25.
// Copyright © 2015年 apple. All rights reserved.
//
#import "ViewController.h"
#import "ViewController2.h"
typedef void(^ViewBlock)();
@interface ViewController ()
@property (nonatomic,copy) ViewBlock block;
@end
@implementation ViewController
- (void)dealloc {
NSLog(@"v1 dealloc!");
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
__block typeof(self) blockSelf = self;
//__weak typeof(self) blockSelf = self;
//arc 中 和 非arc 中在处理block 循环引用的时候,是不一样的,arc 中 只能用__weak 不能用 __block ,在非arc 中 用__block
//否则 如果在arc 中 用 __block 是不起作用的
self.block = ^(){
NSLog(@"%@",blockSelf);
};
}
@end