全部得到正確的UIColor,不能在矩形
我有這段代碼:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
CGContextFillRect(context, CGRectMake(0, 440, 320, 30));
和我這樣稱呼它:
_rectangeView = [[PopUpRectangle alloc] initWithFrame:CGRectMake(0, 538, 320, 30)];
但它是黑色的!
任何意見,爲什麼這是?
在這裏'rect'的值是多少?我懷疑你正在着色的那個實際上是出於觀點的原因。邊界!=幀和所有。 NVM增加了一個答案。 – Fogmeister
是'DrawRect:'有沒有叫?放置一個'NSLog()'看看它是否是。 – Popeye