首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIBarButtonItem自定义视图未正确显示

UIBarButtonItem自定义视图未正确显示
EN

Stack Overflow用户
提问于 2013-04-27 07:21:24
回答 1查看 274关注 0票数 0

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

图像是Pause@2x.png,是40x40像素,这就是我添加按钮的方式

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

发布于 2013-04-27 08:57:32

我试图在稍后的代码中更改工具栏的高度,删除这一行可以修复它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16246585

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档