【发布时间】:2011-07-01 08:37:48
【问题描述】:
我正在使用 3.1.3 SDK 开发 iPhone 应用。
我正在尝试使用以下代码绘制一个透明填充 1px 黑色笔触的三角形:
CGContextMoveToPoint(ctx, position.X, position.Y - (size.height / 2));
CGContextAddLineToPoint(ctx, position.X - (size.width / 2), position.Y + (size.height / 2));
CGContextAddLineToPoint(ctx, position.X + (size.width / 2), position.Y + (size.height / 2));
CGContextFillPath(ctx);
CGContextSetLineWidth(ctx, 1.0);
CGContextStrokePath(ctx);
CGContextSetFillColorWithColor(ctx, [[UIColor clearColor] CGColor]);
但是我得到了一个黑色填充的三角形。
我做错了什么?
【问题讨论】:
-
您应该使用最新版本的 SDK!您仍然可以针对较旧的操作系统。
标签: iphone cocoa-touch iphone-sdk-3.0 quartz-graphics quartz-2d