Taskinul Haque
Taskinul Haque

Reputation: 724

iOS passing an Image to an IBOutlet of another class

I have ClassA and subclass ClassB

Is it possible to pass an image from the UIImage picker from ClassA to ClassB

NSLog(@"Camera Dismiss Method Reached");
[picker dismissViewControllerAnimated:YES completion:nil];
ClassB.patientImage.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

where "patientImage" is a UIViewController (IBOutlet) property of ClassB

and here is the property for Patient Image, in ClassB.h

@property (nonatomic, strong) IBOutlet UIImageView *patientImage;

doing it this way however gives me an error "patientImage" not found on object type

Your help is very appreciated

Upvotes: 1

Views: 169

Answers (1)

Erhan Demirci
Erhan Demirci

Reputation: 4209

objects are usually created using this method:

ClassB myClassBObject=[ClassB alloc]init];

and later you can access to patientImage

myClassBObject.patientImage.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

I hope it's will be work

Upvotes: 1

Related Questions