2010-10-05 66 views
3

因此,当您想要从主屏幕上删除应用程序或从iBooks中删除图书时,当您进入“编辑模式”时,应用程序图标/书籍/应用程序的左上角会有一些小小的X,随你。SDK的主屏幕部分是否为“X”删除按钮?

此按钮是SDK的一部分吗?

如果没有(我敢肯定它不是),有人知道可能包含X图像的Apple示例项目吗?

回答

5

你可以尝试寻找在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

+1

/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 – vikingosegundo 2010-10-06 00:10:52

+0

苹果在SDK中没有使这些无处不在的图标更容易访问,标准图标在Android中可用 – 2012-05-14 15:47:05

0

如果您想使用这张图片,只是:

  • 削减它从什么地方
  • 使背景透明使用Photoshop
  • 图像添加到自定义的UIButton。

对不起,我不记得使用它的任何项目...

2

如果你有兴趣在此画使用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。