tags:

views:

402

answers:

1

Warning : No -setContents method found. messages without a matching method signature will be assumed to return 'id' and accept'...' as arguments ....

This crashes my version of it. Can someone help me to solve it?

code is here :

UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
   message: @"YOUR MESSAGE HERE", nil)
   delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];

[theAlert show];

UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
[theTitle setTextColor:[UIColor redColor]];

UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"];
[theBody setTextColor:[UIColor blueColor]];

UIImage *theImage = [UIImage imageNamed:@"Background.png"];    
theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16];
CGSize theSize = [theAlert frame].size;

UIGraphicsBeginImageContext(theSize);    
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];    
theImage = UIGraphicsGetImageFromCurrentImageContext();    
UIGraphicsEndImageContext();

[[theAlert layer] setContents:[theImage CGImage]];
+1  A: 

Add

#import <QuartzCore/QuartzCore.h>

to your file

oxigen
Hi, I added #import <QuartzCore/QuartzCore.h> to my file,Still It is showing the following warning.: passing argument 1 of 'setContents:' from incompatible pointer type.Help...
nic
Thanks in advance :-)
nic
Try typecasting the CGImage to id: [[theAlert layer] setContents:(id)[theImage CGImage]];
Brad Larson
nic