I am facing a problem in placing an image for an UIBarButtonItem. This is the code I am uisng:
UIBarButtonItem *comoseButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"compose_new.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(composeNewMessage)];
But I am not getting the proper output: the button size is too big. How can I adjust the frame? (I'm developing for iOS 5)
I always design my bar button items to be the right size. That seems the simplest way. I don't know if you've looked it up, but they should be "approximately 20x20" according to the Human Interface Guidelines.
Other than that, I suppose you could create a properly sized UIImageView with your image, add your own responder code or gesture recognizer, and then use initWithCustomView:
.