Wie ändere ich den Buchstabenabstand eines UILabel / UIFont?

Ich habe schon viele gesucht und keine Antwort gefunden.

Ich habe ein normales UILabel, das folgendermaßen definiert ist:

    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];

Und ich wollte, dass der horizontale Abstand zwischen den Buchstaben enger wird, während die Schriftgröße erhalten bleibt.

Gibt es eine Möglichkeit, dies zu tun? Es sollte eine ziemlich einfache Sache sein.

Prost Leute, Andre

AKTUALISIEREN:

Also musste ich es so machen:

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

Aber ich muss das nach rechts ausrichten. Ich könnte das manuell machen, wenn ich die Breite des gezeichneten Textes wüsste, aber es erweist sich als nahezu unmöglich, das zu finden.

Ich habe über ATSU gelesen, aber keine Beispiele gefunden.

Das nervt: /

Antworten auf die Frage(5)

Ihre Antwort auf die Frage