Ho un UILabel e voglio rendere l'interlinea inferiore a 0 (in modo che il testo si avvicini piuttosto che più lontano). Che cosa sto facendo di sbagliato?UILabel interlinea negativa
UIFont* customFont = [UIFont fontWithName:@"BebasNeue" size:70];
NSString * text = @"Their \nIdeas";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text];
NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init];
paragrahStyle.lineSpacing = -30;
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:NSMakeRange(0, [text length])];
UILabel *lbl1 = [[UILabel alloc] init];
lbl1.frame = CGRectMake(120, 0, viewWidth, 300);
lbl1.backgroundColor = [UIColor clearColor];
lbl1.textColor = grayColor;
lbl1.numberOfLines = 2;
lbl1.attributedText = attributedString;
lbl1.userInteractionEnabled = NO;
lbl1.font = customFont;
[view addSubview:lbl1];
[lbl1 setTransform:CGAffineTransformMakeRotation(0.35)];
Cosa fa apparire come con il codice qui? – erdekhayser
Non hai davvero bisogno di un'etichetta qui, quindi quello che farei al tuo posto è creare un UIView personalizzato in cui disegno il testo da solo. In questo modo, puoi mettere le linee dove preferisci. – matt
@matt Stavo per suggerire la stessa cosa. CoreText è probabilmente la strada da percorrere qui. – Fogmeister