2010-10-05 12 views
3

Ainsi, lorsque vous voulez supprimer une application de l'écran d'accueil ou supprimer un livre d'iBooks, lorsque vous entrez dans le mode d'édition, il y a un peu d'itty bitty X dans le coin supérieur gauche de l'application. peu importe.Le bouton de suppression "X" de la partie écran d'accueil du SDK?

Ce bouton fait-il partie du SDK?

Et si ce n'est pas le cas (je suis sûr que ce n'est pas le cas), est-ce que quelqu'un connaît un exemple de projet Apple qui pourrait contenir l'image X?

Répondre

5

Vous pouvez essayer de regarder dans le Springboard.app. (Tremplin est l'écran d'accueil dans iOS.) Il devrait être situé quelque part comme:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*XYZ*.sdk/System/Library/CoreServices/SpringBoard.app/

EDIT: par le commentaire ci-dessous, l'emplacement des images pour le simulateur 4.1 sdk est:

/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/Bibliothèque/CoreServices/SpringBoard.app/closebox \ @ 2x.png – vikingosegundo

+0

Il est un peu remarquable que Apple n'a pas rendu ces icônes omniprésentes plus facilement accessibles dans le SDK, la façon dont les icônes standard sont disponibles dans Android –

0

Si vous souhaitez utiliser cette image, il suffit:

  • Cut de quelque part
  • Faire l'arrière-plan transparent avec photoshop
  • Ajouter l'image à une coutume UIButton.

Désolé, je ne me souviens pas de tout projet qui l'utilise ...

2

Si vous êtes intéressé par le dessin en utilisant ce quartz, le code suivant est tiré d'un CALayer que j'ai créé pour rendre ce genre de bouton supprimer:

#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); 
} 

dans ce cas, strokeColor est un CGColorRef blanc, la couche est 31 x 31 et la strokeWidth est 2.0.