导航栏按钮图像未显示在Swift中 [英] Navigation bar button image not showing in Swift

查看:72
本文介绍了导航栏按钮图像未显示在Swift中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我又回来了。



我正在使用Xcode 7在Swift中编写应用程序。我添加了一个导航控制器并在其上面导航项目,然后是一个条形按钮。我正在尝试将条形按钮的图像更改为我已导入Xcode的png。但是,它只是在设计中以及运行应用程序时显示了这一点。它只是在导航区域显示蓝色污迹。





我已经尝试将图像导入到项目中,也尝试导入到具有相同结果的images.xcassets中。



任何人都知道这里可能出错了什么?



这是我一直想要添加的图片以及我目前的设置。





设置:




I'm back again.

I'm writing an app in Swift using Xcode 7. I've added a navigation controller and on top of that a navigation item, and then a bar button. I'm trying to change the image of the bar button to a png that I've imported into Xcode. However, it just shows this in the design and also when I run the app. It just shows a blue smudge in the navigation area.

I've tried importing the image into the project and also into images.xcassets with the same results.

Anyone know what may be wrong here?

Here's the image I've been trying to add and the settings I currently have.

Settings:

解决方案

The way to resolve navigation button images appearing as blue is to select the image set in Assets.

And then choose Original Image from the Render As select options.

这篇关于导航栏按钮图像未显示在Swift中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆