Reputation: 12780
I have navigation bar controller in which i want to display text. But the text is not the same every time. It will be minimum of 5 and maximum of 60 characters. I want all of the characters to be visible. How can I set min and max font size for UINavigation Bar title?
Thanx
Upvotes: 1
Views: 1366
Reputation: 12780
here is the answer
UILabel *bigLabel = [[UILabel alloc] init];
bigLabel.text = @"1111111122222233333344444455555556666777888899999000000";
bigLabel.backgroundColor = [UIColor clearColor];
bigLabel.textColor = [UIColor whiteColor];
bigLabel.font = [UIFont boldSystemFontOfSize:20];
bigLabel.adjustsFontSizeToFitWidth = YES;
[bigLabel sizeToFit];
self.navigationItem.titleView = bigLabel;
Upvotes: 2
Reputation: 2584
You will need to set the titleView on the UINavigationBar. You can set it to a UILabel with any of the normal UILabel settings.
Upvotes: 1