문제

I would like use navigationItem.title's font, because I insert a Button in titleView and this button have "ABC", but this "ABC" must Specified a font. I need this font same to navigationItem title's font of system; what do I do it?

도움이 되었습니까?

해결책

I believe it's the regular system font [UIFont systemFontWithSize:someSize]. You'll also need to set a small shadow on it to give it the same effect that the title bar has. If you use a UILabel I believe you can set the shadowOffset to be 0,-1 for the same effect as the title bar.

다른 팁

By default, all font types are set to "System".

The font property for UINavigationItem.title is not able to set pragmatically. But you can create a UILabel and set custom font and add as subview.

Try this

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];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top