【发布时间】:2014-03-24 11:29:44
【问题描述】:
全部,
我有这段代码:
- (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的值是多少。我怀疑您正在着色的矩形实际上不在视图的矩形范围内。 bounds != frame 等等。 NVM,添加了一个答案。 -
DrawRect:有没有接到电话???在里面放一个NSLog(),看看是不是。
标签: ios objective-c core-graphics