2013-03-21 2 views
-1

저는 iPhone 개발에 멍청한 사람이고 유리 단추 (found here)를 구현하는 동안 이상한 문제가 있습니다. MOGlassButtons.m 파일 안에 "unexpected in @ program error"가 생기기 때문에 빌드가 실패합니다. 이 문제를 해결하는 방법에 관해서는 아무 것도 찾을 수 없었습니다. 어떤 도움이라도 대단히 감사합니다.유리 단추 UIButton 구현 문제

MOGlassButton.m

self.gradientLayer1.colors = @[(id)[MO_RGBACOLOR(255, 255, 255, 0.45) CGColor], (id)[MO_RGBACOLOR(255, 235, 255, 0.1) CGColor]]; //<--"unexpected @ in program error" 

self.gradientLayer2.colors = @[(id)[MO_RGBACOLOR(205, 205, 205, 0) CGColor], (id)[MO_RGBACOLOR(235, 215, 215, 0.2) CGColor]]; //<--"unexpected @ in program error" 

편집

#import "MOGlassButton.h" 

// Courtesy of https://github.com/facebook/three20 
#ifndef MO_RGBCOLOR 
#define MO_RGBCOLOR(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] 
#endif 
#ifndef MO_RGBCOLOR1 
#define MO_RGBCOLOR1(c) [UIColor colorWithRed:c/255.0 green:c/255.0 blue:c/255.0 alpha:1] 
#endif 
#ifndef MO_RGBACOLOR 
#define MO_RGBACOLOR(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] 
#endif 
+0

MO_RGBACOLOR을 표시해주세요. 만약 내가 생각하기에, 매크로라면, 가능성은 그 원인이다. –

+0

@JuliusMaximilianSteen 제 편집을 확인하십시오 –

+0

CGColorRef를 ID로 전송할 수 없습니다. UIColor를 저장 하시겠습니까? –

답변

1

당신의 문제는 아마 당신이 실행하는 엑스 코드의 오래된 버전입니다. 귀하의 코드는 Xcode 4.4 이후에 지원되어 이전 릴리스에서는 유효하지 않은 Objective-C 리터럴 (@[…] 부분)을 사용합니다. (What are the details of "Objective-C Literals" mentioned in the Xcode 4.4 release notes? 참조)

업그레이드가 문제를 해결해야합니다. 내가 많이 업데이트를 권장하지만

편집은

또는 다음을 사용할 수 있습니다.

[NSArray arrayWithObjects: (id)[MO_RGBACOLOR(255, 255, 255, 0.45) CGColor], (id)[MO_RGBACOLOR(255, 235, 255, 0.1) CGColor], nil];