Bild und Text in Swipe -Aktionen in Swiftui zeigenIOS

Programmierung für iOS
Anonymous
 Bild und Text in Swipe -Aktionen in Swiftui zeigen

Post by Anonymous »

Ich führe meine App auf iOS 17 aus und habe Swipe -Aktionen in List Row hinzugefügt. Ich möchte das Bild der Aktion und des Textes darunter zeigen, aber ich habe festgestellt, dass nur das Bild angezeigt wird.
Code: < /p>

Code: Select all

import SwiftUI
import Foundation

struct ContentView: View {
var body: some View {
NavigationStack {
VStack {
List {
Section {
HStack {
Text("Hello World").font(.body)
Spacer()

Divider().frame(width: 3.0)
.overlay(Color.blue).padding(.trailing, -50.0).padding([.top, .bottom], -1.5)
}
.padding([.top, .bottom], 1.5)
.swipeActions(allowsFullSwipe: false) {
Button(role: .destructive) {
print("Deleting row")
} label: {
/// Note: Want to show Image and text below it.
VStack(spacing: 2.0) {
Image(systemName: "trash")
Text("Delete").font(.caption2)
}

/// Note: Using label as well doesn't show both text and icon. It only shows the icon.
// Label("Delete", systemImage: "trash")
}

// TODO: Add more swipe action buttons
}
}
}
.listStyle(.insetGrouped)
}
}
}
}
Wie zeige ich Bild und Text für die Swipe -Aktion an? I.Sstatic.net/wmwui.png "/>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post