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
.
精彩评论