Como alterar o espaçamento das letras de um UILabel / UIFont?
Já pesquisei cargas e não consegui encontrar uma resposta.
Eu tenho um UILabel normal, definido desta maneira:
UILabel *totalColors = [[[UILabel alloc] initWithFrame:CGRectMake(5, 7, 120, 69)] autorelease];
totalColors.text = [NSString stringWithFormat:@"%d", total];
totalColors.font = [UIFont fontWithName:@"Arial-BoldMT" size:60];
totalColors.textColor = [UIColor colorWithRed:221/255.0 green:221/255.0 blue:221/255.0 alpha:1.0];
totalColors.backgroundColor = [UIColor clearColor];
[self addSubview:totalColors];
E eu queria que o espaçamento horizontal entre as letras fosse mais apertado, mantendo o tamanho da fonte.
Existe uma maneira de fazer isso? Deve ser uma coisa bastante básica a se fazer.
Saúde pessoal, Andre
ATUALIZAR:
Então eu fui forçado a fazer assim:
- (void) drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont (context, "Arial-BoldMT", 60, kCGEncodingMacRoman);
CGContextSetCharacterSpacing (context, -10);
CGContextSetTextDrawingMode (context, kCGTextFill);
CGContextSetRGBFillColor(context, 221/255.0, 221/255.0, 221/255.0, 221/255.0);
CGAffineTransform xform = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
CGContextSetTextMatrix(context, xform);
char* result = malloc(17);
sprintf(result, "%d", totalNumber);
CGContextShowTextAtPoint (context, 0, 54, result, strlen(result));
}
Mas preciso alinhar isso à direita. Eu poderia fazer isso manualmente se soubesse a largura do texto desenhado, mas está quase impossível encontrá-lo.
Eu li sobre o ATSU, mas não consegui encontrar nenhum exemplo.
Isso é péssimo: /