因此,当您想从主屏幕删除应用程序或从 iBooks 中删除书籍时,当您进入“编辑模式”时,应用程序图标/书籍/其他的左上角会有一个小小的 X。
这个按钮是 SDK 的一部分吗?
而且...如果不是(我很确定不是),有人知道可能包含 X 图像的 Apple 示例项目吗?
您可以尝试查看 Springboard.app。(Springboard 是 iOS 中的主屏幕。)它应该位于以下位置:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*XYZ*.sdk/System/Library/CoreServices/SpringBoard.app/
编辑:根据下面的评论,4.1 模拟器 sdk 的图像位置是:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/CoreServices/SpringBoard.app/closebox.png /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk /System/Library/CoreServices/SpringBoard.app/closebox\@2x.png
如果您有兴趣使用 Quartz 进行绘制,以下代码是从我创建的用于呈现这种删除按钮的 CALayer 中提取的:
#define SPACETOEXPANDDELETELAYERFORSHADOW 4.0f
#define FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES 0.38
- (void)renderAsVectorInContext:(CGContextRef)context;
{
if (strokeColor == NULL)
return;
CGContextSetLineJoin(context, kCGLineJoinBevel);
CGContextSetStrokeColorWithColor(context, strokeColor);
CGContextSetLineWidth(context, strokeWidth);
CGContextSetLineCap(context, kCGLineCapRound);
CGRect currentFrame = self.bounds;
currentFrame = CGRectInset(currentFrame, SPACETOEXPANDDELETELAYERFORSHADOW, SPACETOEXPANDDELETELAYERFORSHADOW);
CGContextSetShadow(context, CGSizeMake(2.0f, 2.0f), 2.0f);
CGContextFillEllipseInRect(context, CGRectMake(currentFrame.origin.x + strokeWidth, currentFrame.origin.y + strokeWidth, currentFrame.size.width - (2.0f * strokeWidth), currentFrame.size.height - (2.0f * strokeWidth)));
CGContextStrokeEllipseInRect(context, CGRectMake(currentFrame.origin.x + strokeWidth, currentFrame.origin.y + strokeWidth, currentFrame.size.width - (2.0f * strokeWidth), currentFrame.size.height - (2.0f * strokeWidth)));
CGContextSetLineWidth(context, 1.3f * strokeWidth);
CGContextBeginPath(context);
CGContextMoveToPoint(context, currentFrame.origin.x + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.width, currentFrame.origin.y + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.height);
CGContextAddLineToPoint(context, currentFrame.origin.x + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.width, currentFrame.origin.y + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.height);
CGContextMoveToPoint(context, currentFrame.origin.x + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.width, currentFrame.origin.y + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.height);
CGContextAddLineToPoint(context, currentFrame.origin.x + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.width, currentFrame.origin.y + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.height);
CGContextStrokePath(context);
}
在这种情况下,strokeColor
是一个白色的 CGColorRef,图层是 31 x 31,并且strokeWidth
是 2.0。
如果要使用此图像,只需:
抱歉,我不记得有任何项目使用它...