views:

77

answers:

1

The following line is throwing the error, what's the matter with it?

CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];

My code:

MSHook(void, drawRectLabel, SBIconLabel *self, SEL sel, CGRect rect)  {

CGRect bounds = [self bounds];

NSString *label(MSHookIvar<NSString *>(self, "_label"));

NSString *style = [NSString stringWithFormat:@"color: white; "];

CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
[label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];

}

+1  A: 

I'm not familiar with -sizeWithStyle:forWidth:, but my guess is it returns an object, not a CGSize. Perhaps you could post the interface for that category method?

Ben Gottlieb