釣魚術
swift
swiftui
//
// AddPinAlert.swift
// BaoAnGongFisher
//
// Created by nipapa on 2022/9/22.
//
import SwiftUI
struct AddPinAlert: View {
let screenSize = UIScreen.main.bounds
@Binding var alertIsPresented: Bool
@Binding var myLocationName: String
@State var myLocationRank: String = "3"
var boxTitle: String = "新增私房釣點?"
var body: some View {
VStack {
Text(boxTitle)
TextField("自訂名稱", text: $myLocationName)
.textFieldStyle(RoundedBorderTextFieldStyle())
Picker("", selection: $myLocationRank) {
Text("不推").tag("1")
Text("龜").tag("2")
Text("普通 / 未知").tag("3")
Text("好").tag("4")
Text("超讚").tag("5")
}
Spacer()
HStack (alignment: .center){
Spacer()
Button("好") {
alertIsPresented = false
}
Spacer()
Button("取消") {
alertIsPresented = false
}
Spacer()
}
}
.padding()
.frame(width: screenSize.width * 0.6, height: screenSize.height * 0.25)
.background(Color.cyan)
.clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous))
.shadow(color: Color.gray, radius: 15, x: -1, y: -1)
}
}
struct AddPinAlert_Previews: PreviewProvider {
static var previews: some View {
AddPinAlert(alertIsPresented: .constant(true), myLocationName: .constant(""))
}
}