这是我的代码:
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
Run Code Online (Sandbox Code Playgroud)
但是当我运行应用程序时,我看不到复选标记.
然后我将背景颜色设置为黑色,我可以看到一个白色的复选标记.
如何将复选标记的颜色更改为蓝色等其他颜色?
但是,当我用 包裹它时NavigationLink,占位符文本将居中。用户输入也将居中。
使用时如何保持前导对齐NavigationLink?
我的代码结构如下所示:
enum Tab {
case social
}
struct MainAppView: View {
@State var selection: Tab = .social
var body: some View {
TabView(selection: $selection) {
ZStack{
CustomButton()
NavigationView { SocialView() }
}.tabItem{Image(systemName: "person.2")}.tag(Tab.social)
// other tabs....
}
struct SocialView: View {
// ...
var body: some View {
GeometryReader{ geometry in
VStack{
NavigationLink(destination: Text("test")) {
CustomSearchBar()
//...
}.navigationBarHidden(true)
.navigationBarTitle(Text(""))
}
}
}
}
struct CustomSearchBar: View {
var body: some …Run Code Online (Sandbox Code Playgroud) 目前,我有类似以下内容:
struct ViewA: View {
@FocusState private var focusedField: Bool
var body: some View {
ViewB(focusedField: $focusedField)
// some other views that read focusedField...
}
}
struct ViewB: View {
@State var focusedField: FocusState<Bool>.Binding
var body: some View {
Button(action: {
focusedField = true // ERROR: Cannot assign value of type 'Bool' to type 'FocusState<Bool>'
})
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
好像我可以focusedField毫无问题地传递下去,但无法更新其值。怎么解决这个问题呢?