简体   繁体   English

删除搜索栏中的“取消”按钮背景色

[英]Remove Cancel Button background tint in Search Bar

I'm using XCode 8.2.1 to develop an iOS App. 我正在使用XCode 8.2.1开发iOS应用。 If you look carefully at the Cancel button in the image below, you can see that it has a light shade of blue as the background. 如果仔细查看下图中的“取消”按钮,您会发现它的背景为浅蓝色。 I've been trying to remove this background from the Cancel button with no luck so far: 到目前为止,我一直在尝试从“取消”按钮中删除此背景,但是没有运气:

取消按钮色调背景

I realized it is a low opacity shade of whatever color I give as the "Tint". 我意识到这是一种低透明度的阴影,无论我用什么颜色作为“色调”。 If I set the tint to "Clear color", this annoying background is gone, but the "Cancel" text also gets disappeared. 如果我将色彩设置为“清除颜色”,则该烦人的背景消失了,但“取消”文本也消失了。

色调选择Xcode

How can I remove this background from the cancel button? 如何从取消按钮中删除此背景?

If anyone else is facing this problem, this is how I solved it: 如果还有其他人遇到此问题,这就是我的解决方法:

在此处输入图片说明

I removed this scope title and the tint was gone. 我删除了该范围标题,但色消失了。 I don't know how it got there in the first place! 我不知道它是怎么到达那里的!

您可以使用以下代码隐藏“取消”按钮

searchController.searchBar.showsCancelButton = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM