The block is a property defined in GridScrollView:
typedef BoxView* (^RenderBlock)(NSDictionary* json, CGRect);
@interface GridScrollView : PagingScrollView
@property (nonatomic, copy) RenderBlock renderBlock;
I want to use it like this:
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;
}
While this code works fine the first time around, when it gets reassigned I get an EXC_BAD_ACCESS (code=2, address=0x0) error. What's happening here?