导航栏中的按钮图像具有不同的外观。为什么?
我试图将带有自定义图像的 UIBarButtonItem 放在 UINavigationBar 上。然而,当我这样做时,图像看起来不正确。我希望导航栏上的按钮看起来像下面的按钮。
(这是模拟器的屏幕截图,顺便说一句,不是 Interface Builder)
我通过创建一个 UIButton,使用齿轮图像作为背景,然后简单地将其拖动到 Interface Builder 中右侧栏按钮项的位置,创建了自定义 UIBarButtonItem。看到以编程方式使用前面提到的 UIButton 创建 UIBarButtonItem 因为它的“自定义视图”(-initWithCustomView)具有相同的结果,我相信这也是正在发生的事情。
我不明白的是,当我将按钮图像添加到包含在栏按钮项目中的导航栏中时,为什么按钮图像会失去其漂亮的边缘和颜色渐变。谁能告诉我吗?
提前致谢。
I'm trying to put a UIBarButtonItem with a custom image on a UINavigationBar. When I do however, the image doesn't look right. I want the button on the navigation bar to look like the one below it.
(This is a screenshot from the simulator, by the way, not Interface Builder)
I created the custom UIBarButtonItem by creating a UIButton, using the cog-wheel image as a background, and then simply dragging it to the the right bar button item place in Interface Builder. Seeing as creating a UIBarButtonItem programmatically with the aforementioned UIButton as its 'custom view' (-initWithCustomView) has the same result, I believe this is what is happening as well.
What I don't understand is why the button image lost its nice edges and color gradient when I added it to the navigation bar wrapped in a bar button item. Can anyone tell me?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
图像没有改变。是一样的。只是放在不同的背景下,表现出来的效果是不一样的。您应该考虑增加对比度。
The image hasn't changed. It is the same. Its just that when put on different backgrounds, it is showing differently. You should consider increasing the contrast.