2010-10-05 69 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。