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