SwiftUI:在“列表”编辑模式下更改删除按钮标题

时间:2019-12-03 13:45:59

标签: swiftui

使用内置的DeleteButton编辑列表时,是否可以指定删除按钮标题?

示例代码:

struct ExampleView: View {
    @State
    private var users = ["Paul", "Taylor", "Adele"]

    var body: some View {
        NavigationView {
            List {
                ForEach(users, id: \.self) { user in
                    Text(user)
                }.onDelete(perform: delete)
            }.navigationBarItems(trailing: EditButton())
        }
    }

    func delete(source: IndexSet) { }
}

代码给出了(激活编辑时):

Default delete button:

我想放置“ some_text”而不是“ Delete”-SwiftUI是否可以?另外,是否可以更改一行的删除标题?

0 个答案:

没有答案