123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // AddRemarkView.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/30.
- //
- import UIKit
- class AddRemarkView: UIView {
- @IBOutlet weak var blackView: UIView!
- @IBOutlet weak var titleLab: UILabel!
-
- @IBOutlet weak var remarkTextView: UITextView!
-
- var dataModel : MealFoodMsgModel?
-
- @IBAction func cancelAction(_ sender: UIButton) {
- self.hidden()
- }
-
- @IBAction func sureAction(_ sender: UIButton) {
- self.dataModel?.comment = self.remarkTextView.text
- self.hidden()
- }
-
-
- /// 展示
- public func showWithString(model : MealFoodMsgModel!){
- self.dataModel = model
-
- self.titleLab.text = LanguagesUtil.createTextBy(Ctext: "为\(model.name ?? "")添加备注", Etext: "Add remarks for \(model.name ?? "")")
-
- self.remarkTextView.text = "\(model.comment ?? "")"
- self.remarkTextView.becomeFirstResponder()
-
- kAppDelegateWindow.addSubview(self)
- self.blackView.alpha = 0
- self.frame = CGRect.init(x: 0, y: kSCREEN_HEIGHT, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
- UIView.animate(withDuration: 0.5) {
- self.frame = CGRect.init(x: 0, y: 0, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
- self.layoutIfNeeded()
- }
- DELAY(0.5) {
- self.blackView.alpha = 0.3
- }
- }
-
- /// 隐藏
- public func hidden(){
- self.blackView.alpha = 0
- UIView.animate(withDuration: 0.5) {
- self.frame = CGRect.init(x: 0, y: kSCREEN_HEIGHT, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
- self.layoutIfNeeded()
- }
- DELAY(0.5) {
- self.removeFromSuperview()
- }
- }
-
- }
|