我正在尝试使用 SwiftUI 重新创建 Telegram Messenger 消息 TextField。在电报应用程序中,TextField 有填充,当内容滚动时,内容会出现在该填充区域中:
\n\n我正在尝试使用 SwiftUI 的 iOS 16 重新创建它TextField<S>(S,\xc2\xa0text:\xc2\xa0Binding<String>,\xc2\xa0prompt:\xc2\xa0Text?,\xc2\xa0axis:\xc2\xa0Axis),其中 axis.vertical带有.lineLimit(_ number: Int?)修饰符。
但是当我应用填充和滚动时,内容内的边框出现:
\n\n如何使用 swiftUI 实现 telegram 的应用程序 UI TextField?
我的源代码:
\nif #available(iOS 16.0, *) { \n TextField(\n "MainInputView.Message.TextView", text: $messageInputViewModel.message, \n prompt: Text("MainInputView.Message.TextView", comment: "Message input placeholder"), axis: .vertical\n ) \n .lineLimit(10) \n .padding(.vertical, 8)\n .padding(.horizontal, 15)\n .background(Color.systemBackground) \n .clipShape(RoundedRectangle(cornerSize: .init(width: 20, height: 20)))\n}\nRun Code Online (Sandbox Code Playgroud)\n