在下面的代码中,没有添加额外的填充。但是在预览或模拟器中,TextField和Map视图中有额外的填充/间距。是否有任何修改器可以删除额外的间距
import SwiftUI
import CoreLocation
import MapKit
struct LocationView: View {
@State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
@State private var addressSearchString:String = ""
var body: some View {
VStack {
Text("Confirm Your Location").foregroundColor(.black).background(.blue)
TextField("Search for area, street name...", text: $addressSearchString)
.background(.blue.opacity(0.3))
ZStack(alignment:.bottom) {
Map(coordinateRegion: $region, interactionModes: [.all])
Button(action: {}) {
HStack {
Text("Locate Me")
}
}
.foregroundColor(.green)
.background(.white)
}
Text("Test 1")
.background(.blue)
Text("Test 2")
.background(.green)
Text("Test 3")
.background(.blue)
Text("Test 4")
.background(.green)
Text("Test 5")
.background(.blue)
}.background(.gray)
}
}
1条答案
按热度按时间ajsxfq5m1#
删除相邻子视图之间的距离。