Hei, I am using different subclasses for the different view in my application. for that I am now trying to pass a C4Image from one function to another. My code is as follows: in TakePhoto.m
cropPhoto= [CropPhoto new];
cropPhoto.canvas.frame=CGRectMake(0, 0, self.canvas.width, self.canvas.height);
cropPhoto.canvas.userInteractionEnabled = YES;
[cropPhoto setup:img];
cropPhoto.mainCanvas=self.canvas;
[self.canvas addSubview:cropPhoto.canvas];
img is declared as a C4Image in the TakePhoto.h
in CropPhoto.m I declared the setup function like this
-(void) setup:(C4Image)image{
//some code here
}
In the TakePhoto.m I'm getting the error "No visible @interface for 'CropPhoto' declares the selector 'setup'." I'm doing pretty much the same thing within the one subclass passing NSUIntegers and there it works. So is there anything else I need to do for C4Images or because I'm passing values between subclasses?
Your -(void)setup:(C4Image *)image;
needs to be declared n the .h
file of the class, otherwise no other objects will be able to call it.
You .h should look something like:
@interface CropPhoto
-(void)setup:(C4Image *)image;
@end
The reason for this is that setup:(C4image*)...
is a custom method that you are implementing on your own, so you need to make it visible.
There could be a lot of other reasons as well.* Check out the following answers for different scenarios that generate the same issue:
https://stackoverflow.com/a/10387710/1218605