我的视图是一个黑色矩形......但它不应该......这是我绘制视图的方法,它作为子视图添加到我的表格视图中:
- (void)drawRect:(CGRect)rect
{
//// General Declarations
CGContextRef context = UIGraphicsGetCurrentContext();
//// Color Declarations
UIColor* color3 = [UIColor colorWithRed: 0.102 green: 0.737 blue: 0.612 alpha: 1];
UIColor* buttonStrokeColor = [UIColor colorWithRed: 0.925 green: 0.941 blue: 0.945 alpha: 0.004];
//// Image Declarations
UIImage* image = [UIImage imageNamed: @"image"];
UIColor* imagePattern = [UIColor colorWithPatternImage: image];
//// Group 2
{
//// AddButton Drawing
UIBezierPath* addButtonPath = [UIBezierPath bezierPathWithRect: CGRectMake(280.0, 3.0, 30, 30)];
[color3 setFill];
[addButtonPath fill];
[buttonStrokeColor setStroke];
addButtonPath.lineWidth = 1;
[addButtonPath stroke];
//// Group
{
//// Rectangle Drawing
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake(280.0, 3.0, 30.0, 30.0)];
CGContextSaveGState(context);
CGContextSetPatternPhase(context, CGSizeMake(86, 33));
[imagePattern setFill];
[rectanglePath fill];
CGContextRestoreGState(context);
[buttonStrokeColor setStroke];
rectanglePath.lineWidth = 1;
[rectanglePath stroke];
}
}
代码中是否存在使矩形变黑的东西?(它是一个完整的黑匣子)