可以使用frame(maxWidth: .infinity)来让按钮在水平空间长度上占满,同时可以使用padding()来添加一些间距,例如:

Button(action: {
    // button action
}) {
    Label("Apply to all Wallpapers", systemImage: "list.bullet.rectangle.fill")
        .frame(maxWidth: .infinity)
        .padding()
}

这样就可以让按钮在水平空间长度上占满,并且添加了一些间距。

在swiftUI中使用这种写法:Button label HStack Spacer LabelApply to all Wallpapers systemImage listbulletr

原文地址: https://www.cveoy.top/t/topic/f8AB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录