包含日文字符时缺少 TextField 字体样式 [英] TextField font style missing when it holding Japanese character
问题描述
将字符串传递给视图
//情况一:英文字母没问题测试(甲板:ABCDE")//情况 2:字体样式丢失测试(甲板:アイウエオ")//情况 3:缺少字体样式测试(甲板:ABCアイウエオDE")
<块引用>
结果:case1
结果:case2
结果:case3
目标视图:将字符串值存储在文本字段中
结构测试:查看{@State var 甲板:字符串 = ";var主体:一些视图{虚拟堆栈{TextField("deck name", text: $deck).font(.largeTitle).foregroundColor(颜色.黑色).multilineTextAlignment(.center).lineLimit(1)}}}
如您所见,当文本字段包含日语字符时,字体样式无法正常工作.
非常感谢!
最新版本的 xCode 和 iOS 存在问题.该问题仅在使用 TextField
时发生.如果你使用普通的 Text
它工作正常.
如果我找到了解决此问题的方法,我会通知您.直到那时你不能使用带有这组字符的 TextField
.
Passing the String to a view
// Case 1: English alphabet is no problem
test(deck: "ABCDE")
// Case 2: Font style is missing
test(deck: "アイウエオ")
// Case 3: Font style is missing
test(deck: "ABCアイウエオDE")
Result: case1
Result: case2
Result: case3
Destination view: Store the string value in a text field
struct test: View {
@State var deck : String = ""
var body: some View {
VStack {
TextField("deck name", text: $deck)
.font(.largeTitle)
.foregroundColor(Color.black)
.multilineTextAlignment(.center)
.lineLimit(1)
}
}
}
As you can see, the font style not working properly when the text field holding Japanese Characters.
Thank you very much!
It is bugged with the latest version of xCode and iOS. The problem only occurs when using a TextField
. If you use a normal Text
it works fine.
If I found a way to fix this I'll let you know. Till then you can't use a TextField
with this set of characters.
这篇关于包含日文字符时缺少 TextField 字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!