开发者

Return a CGAffineTransform from a function

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

开发者_如何学Python- (CGAffineTransform)getEllipse

My call to it

CGAffineTransform t = [self getEllipse];

Any help would be great.


Have you made sure that the method is declared somewhere visible to the code that calls it? I.e., if:

- (CGAffineTransform)getEllipse;

is in MyFoo.h, and MyBar.m contains:

CGAffineTransform t = [self getEllipse];

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜