Hi, I have written an application in which I want to convert a .jpg image to .bmp format but I it fails with the error:
class_name' may not respond to methd_name".
My code is following :
#import "CalculateRGBViewController.h"
@implementation CalculateRGBViewController
@synthesize skinImage;
@synthesize lblRedColor,btn,img;
struct pixel {
unsigned char r, g, b,a;
};
-(IBAction)btnClick:(id) sender{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
skinImage. image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
+(void)calculateRGB:(UIImage *)skinImage {
struct pixel *pixels = (struct pixel *) calloc(1, skinImage.size.width * skinImage.size.height * sizeof(struct pixel));
if (pixels != nil)
{
// Create a new bitmap
CGContextRef context = CGBitmapContextCreate(
(void*) pixels,
skinImage.size.width,
skinImage.size.height,
8,
skinImage.size.width * 4,
CGImageGetColorSpace(skinImage.CGImage),
kCGImageAlphaPremultipliedLast
);
NSLog( @"Pixel data one red (%i)", context);
}
}
-(IBAction)btnCalRGB:(id) sender
{
[self calculateRGB];
}
The shown me following code.
-(IBAction)btnCalRGB:(id) sender
{
[self calculateRGB];
}
Warning: CalculateRGBController may not respond to calculateRGB in btnCalRGB button function.
Edit01:
I have also implemented in my code but it again showing same warning.
[self calculateRGB:anUIImage];
-(IBAction)btnCalRGB:(id) sender;
but it again showing same warning. When the button above is pressed, the program throws and exception.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[UIImage skinImage]: unrecognized selector sent to