tvOS Textfield Transparent Background

孤人 提交于 2021-01-05 07:07:41

问题


I am working on a tvOS project. I use swift and siwftUI, and I want to create a TextField with a transparent background. The thing is when I set the background color to transparent, there is still a layer of highlight and when you navigate and focus is on the text field it expands. I tried many things but I was not able to solve it. Then I decided to go with the background color but this layer is still there and I cannot get rid of it.

As you can see in the picture, that layer is visible in the TextField with a white background and you can clearly see the layer in the TextField with no background(or transparent background). As you navigate it becomes bigger or smaller depending on the focus.

The code is so simple. It is just a TextField, with a background option.

TextField("", text: self.$mail)
    .padding()
    .frame(width: 300, height: 45)
    .bacground(Color(red: 250.0/255, green: 250.0/255, blue: 250.0/255)) 

I did not have such issues in iOS. I feel like it is some tvOS option created because of the remote. I could not find any solution. I remember that I had the same issue with objective c and UIKit but I do not know the reason or the solution.

来源:https://stackoverflow.com/questions/61807833/tvos-textfield-transparent-background

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!