What is the maximum size for a UINavigationBar titleView?
I want to add a logo to the navigation bar on the first view controller, but it scales it badly because I don't know what the maximum size is. Does anyone know?
By the way, I know about the trick for creating full-sized images but I don't want to do that, I just want to utilise the built-in titleView开发者_运维问答 property.
Thanks!
In general, I think that the title view is adjusted to whatever space other views leave left and right. At least that is the behavior of the standard title view.
Have you tried to play with the contentMode
property of your UIImageView
(which I assume you put into the titleView
)? If not, try
imageView.contentMode = UIViewContentModeScaleAspectFit;
and try out a suitable CGRect
for the frame
. If your image is just large enough for the smallest title view, it should work no matter how wide the title view gets.
精彩评论