-1
我是iphone開發的noob,我嘗試實現玻璃按鈕時有一個奇怪的問題(found here)。我的構建失敗了,因爲我在MOGlassButtons.m文件中出現了「程序錯誤中意外的@」。我一直無法找到有關如何解決此問題的任何信息。任何幫助是極大的讚賞。問題實現玻璃按鈕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
您能向我們展示MO_RGBACOLOR嗎?如果它,如我所料,宏觀,它可能是罪魁禍首。 – 2013-03-21 23:23:18
@JuliusMaximilianSteen請檢查我的編輯 – 2013-03-21 23:26:43
你不能只是將CGColorRef轉換爲ID,爲什麼你不只是存儲UIColor – 2013-03-21 23:53:05