我有一个ActionSheet,但我不知道如何从操作表回调按钮导航到另一个视图。
let action = ActionSheet.Button.cancel {
//navigation???
}
ActionSheet(title: Text("some title"), buttons: [action])
IE:在从不同来源(相机或胶卷)中选择图像时,我希望以此作为选择器。
答案 0 :(得分:2)
这是实现此目标的方法:
C1 and C2
您也可以使用var query = from x in ListB
join y in ListA
on x.C1C2 equals y.C1C2
select y;
//Update metadata from ListA to ListB
foreach (var x in query)
{
var itemToChange = ListB.FirstOrDefault(d => d.C1C2 == x.C1C2);
if (itemToChange != null)
itemToChange.Desc1 = x.Desc1;
itemToChange.Desc2 = x.Desc2;
itemToChange.DataType = x.DataType;
}
代替struct ContentView: View {
@State var isSheet: Bool = false
@State var isPresented: Bool = false
var body: some View {
NavigationView {
Button(dict.description) {
self.isSheet = true
}.actionSheet(isPresented: $isSheet) {
ActionSheet(title: Text("Some title"), message: nil, buttons: [
.default(Text("Present view")) {
self.isPresented = true
},
.cancel()
])
}
.navigationBarTitle(Text("Home"))
.sheet(isPresented: $isPresented, content: { Text("This is another view!") })
}
}
}