I declared a block in .h: void (^block)(BOOL);
I initialize it:
I initialize it in .m:
I pass it as a parameter:
And then try to call it, passing it the boolean:
but it fails with above saying with the call to block(TRUE) with compile error: "expected identifier"
thanks for response
I initialize it:
I initialize it in .m:
Code:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
block = ^(BOOL noshow)
{
if(noshow){
AutoTracView.hidden = YES;
MarineTracView.hidden = YES;
}
};
}
return self;
}
I pass it as a parameter:
Code:
[self renderView:[current_unit.unit_type intValue] onCollection:(NSDictionary *)collection withBlock:block];
And then try to call it, passing it the boolean:
Code:
-(void)renderView:(int)value onCollection:(NSDictionary *)collection withBlock:block
{
block(TRUE);
NSString *index = [NSString stringWithFormat:@"%d", value];
UIView *view = [collection objectForKey:index];
view.hidden = NO;
}
but it fails with above saying with the call to block(TRUE) with compile error: "expected identifier"
thanks for response