Pierre Bernard

My little hideout on the net

Sample use of HHBlockPerform

HHPerformBlock SetterBlock(id inValue, NSString *inKey)
{
HHPerformBlock block = ^(id owner) {
[owner
willChangeValueForKey:inKey];
[owner
associateValue:inValue withKey:inKey];
[owner
didChangeValueForKey:inKey];
};

return [[block copy] autorelease];
}

/* ... */

- (
NSNumber*)progressMinValue
{
return [self associatedValueForKey:@"progressMinValue"];
}

- (
void)setProgressMinValue:(NSNumber*)inValue
{
[
self performOnMainThreadWait:YES block:SetterBlock(inValue, @"progressMinValue")];
}
Comments