开发者

Why do I get "Invalid receiver type 'NSInteger'"?

开发者 https://www.devze.com 2023-01-13 00:05 出处:网络
Probably a simple question: Why do I get an compiler warning for the following objective-C code? //_classificationView.tag is a NSString

Probably a simple question: Why do I get an compiler warning for the following objective-C code?

//_classificationView.tag is a NSString

CGFloat imageWidth =  [_classificationView.tag floatValue] * 14.0;

And why does it开发者_C百科 say something about NSInteger?

Thanks for answers! Dennis


Because the tag property is a NSInteger and not a class type. Just use the following instead:

CGFloat imageWidth =  _classificationView.tag * 14.0;
0

精彩评论

暂无评论...
验证码 换一张
取 消