cocoa - Hidden [CIImage initWithImage:] method? -


What Apple has not declared method [CIImage initWithImage: (CIImage *)] me ? The only way I know with that signature is the [CISampler initWithImage:] . But when I try to provide my own method, the compiler is warning me that this method already exists.

Background: I am trying to create a feature method which is a NSImage for example CIImage . Then I have created a class method [CIImage initWithImage:] which takes an NSImage example.

The class method declaration:

  @ interface Siaimaj (Kwartjhkor Akstras) - (id) Int with Aymej: (Ansaimj *) IMG; @end  

I tried to use it in the NSImageView subclass to cache the core image version of the image:

  - (zero) set image: (nsimaj *) new image {[super set image: new image]; [Ciimage release]; CiImage = [[CIMAZ ALOOC] Init with IIMAG: new image]; }  

But when I compile the above method, I get a warning that someone else has already defined the method and takes a different parameter:

< pre> warning: incompatible Objective-C type 'struct NSImage *', expected 'straight CIImage *' when 'initWithImage' logic 1:

passed To define "option in XCode, the only other implementation of the method (except for my own implementation) is [CISampler initWithImage: (CIMF *) . I am really surprised by the issue - is there anything wrong?

For complete perfection, here [ Siaimaji Int with impressions:] :

  @implementation method body CIImage (Kwartjhkor Akstras) - (id) initWithImage: (NSImage *) img {NSData * tiffData = [ IMG TIFF Representation]; NSBitmapImageRep * bitmap = [NSBitmapImageRep imageRepWithData: tiffData]; return [self initWithBitmapImageRep: bitmap];} @end  

thanks in advance.

On an estimate, you are not included in the header that defines your category in your .m file Here the trick is that [CIMAG ALLOCK] gives the value of type 'ID' as they do not know just to limit the search in the CIMS category, and instead search for all the classes. That's why they get definitions in Cismampler.

I think that if you change your code to:

  ciImage = [((CImage *) [Siaimaji light]) initWithImage: newImage];  

You may get past the alert, because there will be more clues about the compiler to use initWithImage:

Because of the misery, its poor Change the name of your method what you did initWithNSImage: - In the long run, it will be easy to support.

(Apple should actually nominate its methods initWithNSImage: but they generally "ns" in their own way, and by its own structure, they win).


Comments