Jamie
Jamie

Reputation: 1

Error: Conversion from 'objc_object*' to non-scalar type 'CGSize' requested. Please help?

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];

}

Upvotes: 0

Views: 860

Answers (1)

Ben Gottlieb
Ben Gottlieb

Reputation: 85532

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?

Upvotes: 1

Related Questions