0

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: enter image description here 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 enter image description here Pause@2x.png enter image description here

4

1 回答 1

0

我试图在代码后面更改工具栏的高度,删除该行修复它。

于 2013-04-27T00:57:32.137 回答