In my UIViewController i set my title dynamically so i do not know the length of the string that will be shown in the navigation bar and because of that i have the current situation:
alt text http://img94.imageshack.us/img94/2484/picture3vf.png
is there any way to set the width of the label that displays the title in the navigation bar? or should i think of a with, compare the text length to it and if it is too long should i resize it and display the famous "..." ?
I know that i can add an UILabel as subview to the navigationBar but i don't want to use that solution.
Thank you!
Maybe you could add some dummy buttons to the navigation bar that will sit directly underneath your buttons. That would show the normal text behavior, but also allow you to play with your colors.
I'm not sure how you did that. If I'm creating a navigation view and setting a title that is too long it will be shortened with "..." by default. These black buttons do not seem to be default buttons.
You can use sizeWithFont method of NSString to know the size your label will take. Note that you can add a maximum size if you know your label width shouldn't be greater than a certain value
// Get the size really needed for the label string
CGSize expectedLabelSize = [self.text sizeWithFont:self.font
constrainedToSize:maximumSize
lineBreakMode:self.lineBreakMode];