0
我的觀點是一個黑色的矩形...但它不應該是... 這裏是我的繪畫認爲,這是添加到我的表視圖作爲一個子視圖方法:爲什麼我的視圖是黑色的?
- (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];
}
}
莫不是在使矩形黑色的代碼中的東西? (它是一個全黑盒子)
謝謝,這工作。順便說一下,當我通過給它一個角落半徑來裁剪視圖時,應該被裁剪的部分充滿了黑色,這並不是我需要的圓形外觀。你知道爲什麼發生了嗎? – EvilAegis
其實nvm我修好了 – EvilAegis