有什么办法可以使操作表中没有标题部分? SwiftUI代码中的“动作表”定义如下:
public struct actionSheet {
/// Creates an action sheet with the provided buttons.
public init(title: Text,message: Text? = nil,buttons: [actionSheet.Button] = [.cancel()])
/// A button representing an operation of an action sheet presentation.
public typealias Button = Alert.Button
}
由于标题仅符合Text,所以我认为也许仅添加Text(“”)即可完成工作;但是,这将使标题的空间为空,而不是将其删除。用nil代替Text(“”)也不起作用。
此外,有什么方法可以使操作表的按钮具有视图,如下所示:
struct actionItem: View {
var body: some View {
HStack {
Image(systemName: "phone")
Spacer()
Text("Call 1-408-123-4567")
}
}
}