从函数返回 CGAffineTransform
我有一个实例方法,我想返回 CGAffineTransform。我目前收到错误
Semantic Issue: Initializing 'CGAffineTransform' (aka 'struct CGAffineTransform') with an expression of incompatible type 'id'
我的方法名称
- (CGAffineTransform)getEllipse
我对它的调用
CGAffineTransform t = [self getEllipse];
任何帮助都会很棒。
I have a instance method that I'd like to return a CGAffineTransform. I'm currently getting the error
Semantic Issue: Initializing 'CGAffineTransform' (aka 'struct CGAffineTransform') with an expression of incompatible type 'id'
My method name
- (CGAffineTransform)getEllipse
My call to it
CGAffineTransform t = [self getEllipse];
Any help would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否确保该方法在调用它的代码可见的地方声明?即,如果:
在 MyFoo.h 中,并且 MyBar.m 包含:
则 MyBar.m 需要
#import "MyFoo.h"
。在无法看到声明的情况下,调用代码将假定该方法返回未知类型的对象,即id
。Have you made sure that the method is declared somewhere visible to the code that calls it? I.e., if:
is in MyFoo.h, and MyBar.m contains:
then MyBar.m needs to
#import "MyFoo.h"
. Without being able to see the declaration, the calling code will assume that the method returns an object of unknown type, a.k.a.id
.