在我们实现blok方法的方法体的时候,如果需要用到当前类的某些属性,不能直接使用self关键字,因为这样做会导致循环引用,需要如下代码
__weak typeof(self) ws = self;
tabb.btnOnclick = ^(NSInteger index){
ws.selectedIndex = index;
};
在我们实现blok方法的方法体的时候,如果需要用到当前类的某些属性,不能直接使用self关键字,因为这样做会导致循环引用,需要如下代码
__weak typeof(self) ws = self;
tabb.btnOnclick = ^(NSInteger index){
ws.selectedIndex = index;
};