我正在尝试制作一个音频播放器,并在底部有一个工具栏。我以编程方式添加了一个带有UIImageView作为其customView属性的barbutton项,但当图像显示时,它几乎不会出现在屏幕上:

图像是Pause@2x.png,是40x40像素,这就是我添加按钮的方式
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

发布于 2013-04-27 08:57:32
我试图在稍后的代码中更改工具栏的高度,删除这一行可以修复它。
https://stackoverflow.com/questions/16246585
复制相似问题