I am attempting to resize the image that I placed in the navigationItem.titleView
of my TableViewController. I used the following code in my TableViewController viewDidLoad
to accomplish this:
UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
iv.contentMode = UIViewContentModeScaleAspectFit;
UIImage* image = [UIImage imageNamed:@"logo.png"];
[iv setImage:image];
self.navigationItem.titleView = iv;
However, the image does not seem to be affected by the frame of 40 x 40 that I set. The result looks like this:
The image is clearly exceeding the 40 x 40 limit that I specified. How can I get the image to not take up all the available space in the navigation bar? I want the logo to be smaller and have a bit of padding on the top and bottom.