2009-10-16 4 views
1

경고 : No -setContents 메서드 이 발견되었습니다. 일치하는 메소드 서명이없는 메시지는UIAlertView의 배경색이 바뀌고 있습니다. 경고 : No -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]]; 
+0

애플에 의해 허용 배경을 변경하는이 방법 파일에

#import <QuartzCore/QuartzCore.h> 

을 추가 하시겠습니까? – random

답변

1

+0

안녕하세요, 내 파일에 #import 를 추가했습니다. 여전히 다음과 같은 경고가 표시됩니다. : 호환되지 않는 포인터 유형에서 'setContents :'의 인수 1을 전달합니다. Help ... –

+0

미리 감사드립니다 :-) –

+0

CGImage를 id에 typecasting 해보세요. [[theAlert layer] setContents : (id) [theImage CGImage]]; –

관련 문제