Pregunta

Me gustaría usar navigationItem.title's fuente, porque inserto un botón en titleView Y este botón tiene "ABC", pero este "ABC" debe especificar una fuente. Necesito esta fuente igual a navigationItem Fuente del sistema del título; ¿Qué lo hago?

¿Fue útil?

Solución

Creo que es la fuente del sistema regular [UIFont SystemFontWithSize: Somesize]. También necesitará establecer una pequeña sombra para darle el mismo efecto que tiene la barra de título. Si usa un uilabel, creo que puede establecer el shadowoffset para que sea 0, -1 para el mismo efecto que la barra de título.

Otros consejos

Por defecto, todos los tipos de fuentes se establecen en "Sistema".

La propiedad de fuente para uinavigationItem.title no puede establecerse pragmáticamente. Pero puede crear una uilabel y configurar la fuente personalizada y agregar como subview.

Prueba esto

UILabel *label=[[UILabel alloc]init];
label.frame=CGRectMake(100,10,200,24);   //You have to adjust frame here.
label.font=[UIFont fontWithName:@"Helvetica" size:14];
[self.navigationController.navigationItem addSubView:label];
[label release];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top