Iphone 更改UIAlertView的背景色时,我收到警告:找不到-setContents方法

Iphone 更改UIAlertView的背景色时,我收到警告:找不到-setContents方法,iphone,Iphone,警告:否-setContents方法 建立不匹配的消息 方法签名将假定为 返回“id”并接受“…”作为 论点 这使我的版本崩溃了。 有人能帮我解决吗 代码如下: UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"YOUR MESSAGE HERE", nil) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:

警告:否-setContents方法 建立不匹配的消息 方法签名将假定为 返回“id”并接受“…”作为 论点

这使我的版本崩溃了。 有人能帮我解决吗

代码如下:

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]];

#导入
添加到您的文件中

#导入

在您的文件中

您好,我添加了#导入到我的文件,但它仍显示以下警告:正在从不兼容的指针类型传递“setContents:”的参数1。帮助…尝试将CGImage键入id:[[theAlert layer]设置内容:(id)[theImage CGImage]];您好,我已将#导入到我的文件中,但它仍显示以下警告:正在从不兼容的指针类型传递“setContents:”的参数1。帮助…尝试将CGImage键入id:[[theAlert layer]设置内容:(id)[theImage CGImage]];这种改变背景的方法苹果可以接受吗?这种改变背景的方法苹果可以接受吗?
#import <QuartzCore/QuartzCore.h>