0
下面这行是抛出错误,它是怎么回事?错误:请求将'objc_object *'转换为非标量类型'CGSize'。请帮忙?
CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
我的代码:
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];
}
sizeWithStyle:forWidth的返回类型是什么? – TomH 2010-09-24 12:50:15
'-sizeWithStyle:forWidth:'必须位于自定义类别中,因为它没有记录为iOS SDK的一部分。不知道这个方法做了什么,我们无法回答你的问题。 – 2010-09-24 17:08:10