//.........some other views........
ZStack(alignment: .leading ) {
Color.black.ignoresSafeArea()
TextEditor(text: $mytext)
.background(Color.orange)
.padding()
.foregroundColor(Color.gray)
.frame(width: 362, height: 400)
}
Background color remains Color.white for all cases i applied so what's wrong here? Thank you.
You can't really change the background
of SwiftUI TextEditor . Either material/shape/color is not possible for applying as a background of SwiftUI TextEditor.
However, you can multiply the color of your TextEditor which provides a similar result to the general background(.color) except it's not really a background color.
TextEditor(text: $mytext)
.colorMultiply(.orange) //modified
.padding()
.foregroundColor(Color.gray)
.frame(width: 362, height: 400)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.