登錄,注冊頁面

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

// Override point for customization after application launch.

self.window = UIWindow(frame:UIScreen.main.bounds)

self.window?.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)

self.window?.makeKeyAndVisible()

self.window?.rootViewController = UIViewController()

let ImageView = UIImageView(frame:CGRect(x: 157, y: 20, width: 100, height: 100))

ImageView.image = #imageLiteral(resourceName: "a.jpeg")

ImageView.layer.cornerRadius = 50

ImageView.layer.masksToBounds = true

self.window?.addSubview(ImageView)

let Lable = UILabel(frame:CGRect(x: 50, y: 140, width: 50, height: 40))

Lable.text = "賬號"

Lable.backgroundColor = #colorLiteral(red: 0.9880268512, green: 0.9258960921, blue: 1, alpha: 1)

Lable.layer.cornerRadius = 10

Lable.layer.masksToBounds = true

self.window?.addSubview(Lable)

Lable.tag = 200

let textField = UITextField(frame:CGRect(x: 120, y: 140, width: 264, height: 40))

textField.backgroundColor = #colorLiteral(red: 0.8976129821, green: 0.6902934195, blue: 0.9686274529, alpha: 1)

textField.borderStyle = .roundedRect

textField.placeholder = "請輸入賬號"

textField.clearsOnBeginEditing = true

textField.keyboardType = .emailAddress

textField.layer.cornerRadius = 10

textField.layer.masksToBounds = true

self.window?.addSubview(textField)

let Lable2 = UILabel(frame:CGRect(x: 50, y: 200, width: 50, height: 40))

Lable2.text = "密碼"

Lable2.backgroundColor = #colorLiteral(red: 0.9880268512, green: 0.9258960921, blue: 1, alpha: 1)

Lable2.layer.cornerRadius = 10

Lable2.layer.masksToBounds = true

self.window?.addSubview(Lable2)

Lable2.tag = 200

let textField2 = UITextField(frame:CGRect(x: 120, y: 200, width: 264, height: 40))

textField2.backgroundColor = #colorLiteral(red: 0.8976129821, green: 0.6902934195, blue: 0.9686274529, alpha: 1)

textField2.layer.cornerRadius = 10

textField2.layer.masksToBounds = true

textField2.borderStyle = .roundedRect

textField2.placeholder = "請輸入密碼"

textField2.clearsOnBeginEditing = true

textField2.keyboardType = .emailAddress

textField2.isSecureTextEntry = true

self.window?.addSubview(textField2)

let button = UIButton(frame:CGRect(x: 50, y: 260, width: 50, height: 40))

button.setTitle("登錄", for: .normal)

button.backgroundColor = #colorLiteral(red: 0.922887975, green: 0.7753175045, blue: 1, alpha: 1)

button.layer.cornerRadius = 10

button.clipsToBounds = true

self.window?.addSubview(button)

button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)

let Button2 = UIButton(type: .custom)

Button2.setTitle("注冊", for: .normal)

Button2.backgroundColor = #colorLiteral(red: 0.922887975, green: 0.7753175045, blue: 1, alpha: 1)

Button2.layer.cornerRadius = 10

Button2.clipsToBounds = true

Button2.frame = CGRect(x: 330, y: 260, width: 50, height: 40)

self.window?.addSubview(Button2)

Button2.addTarget(self, action: #selector(Button2Action), for: .touchUpInside)

return true

}

// MARK:- button的點擊事件

func buttonAction()? {

print("登錄成功")

}

// MARK:- playButton的點擊事件

func Button2Action(button:UIButton)? {

print("注冊成功")

}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容