ブロックは、GridScrollView で定義されたプロパティです。
typedef BoxView* (^RenderBlock)(NSDictionary* json, CGRect);
@interface GridScrollView : PagingScrollView
@property (nonatomic, copy) RenderBlock renderBlock;
私はそれを次のように使いたいです:
switch(current.tag)
{
case 1:
scrollView.renderBlock = ^(NSDictionary* json, CGRect frame)
{
//returns a boxview
}
break;
case 2:
scrollView.renderBlock = ^(NSDictionary* json, CGRect frame)
{
//returns a different boxview
}
break;
}
このコードは最初は正常に機能しますが、再割り当てされると EXC_BAD_ACCESS (code=2, address=0x0) エラーが発生します。ここで何が起こっているのですか?