简体   繁体   English

如何在 xcode 的 storyboard 中更改文本视图的背景

[英]How to change the background of a Text View in the storyboard of xcode

I am running into a problem in xcode storyboard to setup the graphics of an app.我在 xcode storyboard 中遇到问题来设置应用程序的图形。 Nothing complicated, but I seriously don't understand the logic.没什么复杂的,但我真的不明白其中的逻辑。

  1. Import an image view that will be the background.导入将作为背景的图像视图。 It is set as opaque, alpha = 1, it uses an image found on internet and the background is "default".它设置为不透明,alpha = 1,它使用在互联网上找到的图像,背景为“默认”。 It covers the whole iphone surface它覆盖了整个 iphone 表面

  2. Import a text view.导入文本视图。 Now I am trying to have the background colour of the text view white.现在我正在尝试将文本视图的背景颜色设置为白色。 To do that, on the "Text Field" section, I have tried to use an image of white, found on the internet, no success.为此,在“文本字段”部分,我尝试使用在互联网上找到的白色图像,但没有成功。 I have also tried in the "View" section to set the "Background" to white colour with alpha=1 and opaque activated, no success, the text view background looks exactly like the background picture, it does not stand out.我还尝试在“视图”部分将“背景”设置为白色,alpha=1 并激活不透明,但没有成功,文本视图背景看起来与背景图片完全一样,它并不突出。

Does anyone know how to do this?有谁知道如何做到这一点?

In case anyone wonders, I have been able to solve this programmatically using code lines like:如果有人想知道,我已经能够使用以下代码行以编程方式解决这个问题:

 myTextField.backgroundColor = UIColor.white

Still not sure why it does not work on the interface builder though.仍然不确定为什么它在界面生成器上不起作用。

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

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