O botão de exclusão "X" está na parte de tela inicial do SDK?
Pergunta
Então, quando você deseja excluir um aplicativo da tela inicial ou excluir um livro do iBooks, quando você entra no "modo de edição", há um pouco de Itty Bitty X no canto superior esquerdo do ícone/livro do aplicativo/o que for.
Este botão faz parte do SDK?
E ... se não (tenho certeza de que não é), alguém conhece um projeto de amostra da Apple que pode conter a imagem X?
Solução
Você pode tentar procurar no trampolim.app. (Springboard é a tela inicial do iOS.) Ele deve estar localizado em algum lugar como:
/Developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator*xyz**.sdk/system/library/coreServices/springboard.app/
EDITAR: De acordo com o comentário abaixo, a localização das imagens para o simulador 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
Outras dicas
Se você estiver interessado em desenhar isso usando o Quartz, o código a seguir será retirado de uma calayer que eu criei para renderizar esse tipo de botão de exclusão:
#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);
}
nesse caso, strokeColor
é um cgcolorref branco, a camada é 31 x 31 e o strokeWidth
é 2.0.
Se você quiser usar esta imagem, apenas:
- Corte de algum lugar
- Faça o fundo transparente com o Photoshop
- Adicione a imagem a um UIBUTTON personalizado.
Desculpe, não me lembro de nenhum projeto que o use ...