I'm trying to make an audio player, and have a toolbar on bottom. I programmatically add a barbutton item with a UIImageView
as it's customView
property, but when the image displays it is barely on screen:
the image is Pause@2x.png
, is 40x40
pixels, and this is how I add the button
UIBarButtonItem *flex1, *flex2;
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Pause@2x.png"]];
self.play = [[UIBarButtonItem alloc] initWithCustomView:iv];
[self.play setAction:@selector(pauseButtonClicked:)];
flex1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
flex2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[self.bar setItems:@[flex1, _play, flex2]];
Pause.png
Pause@2x.png