2012-09-25 11 views
10

Estoy trabajando en una aplicación de Iphone y necesito mostrar un texto grande. Necesito que tenga una alineación de párrafo. Por favor, consulte la imagen a continuación para obtener una explicación.Alignment de texto de párrafo de UILabel

Intenté usar UILabel y UITextView pero no pude encontrar la propiedad para hacerlo.

Gracias por cualquier ayuda.

enter image description here

+1

+1 para un claro y conciso, bien ilustrado pregunta – Damo

+0

Comprobar este enlace http://stackoverflow.com/ preguntas/7378409/uilabel-justify-left-and-right te ayudará, es similar a tu pregunta. –

Respuesta

1

Uso TTTAttributedLabel etiqueta NSAtributedString que tiene UITextAlignmentJustify

yourTTTAttributedLabel.textAlignment = UITextAlignmentJustify; 

También otra alternativa es utilizar OHAttributedLabel etiqueta NSAtributedString que tiene UITextAlignmentJustify

yourOHAttributedLabel.textAlignment = UITextAlignmentJustify; 
1

UITextView y UILabel ellos no proporcionar tal alineación. Puede usar UIWebview en su lugar.

Puede utilizar <p style="text-align:justify">Your text goes here.</p>

Esto podría ser útil.

1

para iOS> 7.1 acaba de establecer la propiedad textAligment a NSTextAlignmentJustified, sin ningún tipo de bibliotecas de tercera parte:

UILabel *label = [UILabel alloc] init]; 
label.textAligment = NSTextAlignmentJustified;