1
所以...我有這個應用程序繪製形狀,然後用戶可以爲它們着色。我做了一個有4個形狀的tabbar,當點擊一個時,相應的形狀被繪製出來。我從quartzDemo中獲取了繪圖的想法。所以我有一個形狀通用類,然後shape_name的形狀子類。這是Square的代碼。核心圖形顏色上下文
@implementation Square
- (void)drawInContext:(CGContextRef)context {
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextSetLineWidth(context, 1.0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, 1, 1);
CGContextAddLineToPoint(context, 1, 79);
CGContextAddLineToPoint(context, 79, 79);
CGContextAddLineToPoint(context, 79, 1);
CGContextAddLineToPoint(context, 1, 1);
CGContextClosePath(context);
CGContextStrokePath(context);
}
@end
當形狀被竊聽的彩色菜單出現,我想改變顏色時,從菜單按鈕被竊聽。我怎樣才能做到這一點。
Ty提前。
那樣做了......謝謝 – 2011-02-09 11:20:59