3

そのため、ホーム画面からアプリを削除したり、iBooks から本を削除したりしたい場合、「編集モード」に入ると、アプリ アイコン/本/その他の左上隅に小さな X が表示されます。

このボタンは SDK の一部ですか?

そして...そうでない場合(そうではないと確信しています)、Xイメージを含む可能性のあるAppleサンプルプロジェクトを知っている人はいますか?

4

3 に答える 3

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

于 2010-10-05T21:42:07.200 に答える
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 です。

于 2010-10-07T17:17:16.583 に答える
0

この画像を使用する場合は、次のようにします。

  • どこかから切り取って
  • フォトショップで背景を透明にする
  • 画像をカスタム UIButton に追加します。

申し訳ありませんが、それを使用するプロジェクトを覚えていません...

于 2010-10-05T21:36:44.577 に答える