视图变成了一个黑色的矩形,下面是画视图的代码:
- (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];
}
}
不知道为什么变成黑盒子了?