Bild und Text in Swipe -Aktionen in Swiftui zeigen

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Bild und Text in Swipe -Aktionen in Swiftui zeigen

by Anonymous » 25 Feb 2025, 08:17

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 "/>

Top