123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // SBTSetFileNameVCtr.swift
- // SolarBT
- //
- // Created by weclouds on 2019/6/16.
- // Copyright © 2019 weclouds. All rights reserved.
- //
- import UIKit
- import SwiftPopup
- class SBTSetFileNameVCtr: SwiftPopup ,UITextFieldDelegate{
- var completeHandle:((String?)->Void)?
- var saveCallBack:((String?)->Void)?
- @IBOutlet weak var box: UIView!
- @IBOutlet weak var textBox: UIView!
- @IBOutlet weak var saveBtn: UIButton!
- @IBOutlet weak var textfield: UITextField!
-
- @IBOutlet weak var paramterExport: UILabel!
- @IBOutlet weak var placeHolderLabel: UILabel!
-
- @IBOutlet weak var backBtn: UIButton!
-
- @IBOutlet weak var shareButton: UIButton!
-
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- createUI()
- }
- @IBAction func shareAction(_ sender: Any) {
- completeHandle!(self.textfield.text)
- self.dismiss()
- }
-
- @IBAction func saveAction(_ sender: Any) {
-
- //completeHandle!(self.textfield.text)
- saveCallBack!(self.textfield.text)
- self.dismiss()
- }
-
- @IBAction func backAction(_ sender: Any) {
- self.dismiss()
- }
-
- }
- extension SBTSetFileNameVCtr{
- func createUI () {
-
- paramterExport.text = "Paramter_exported".da_localizedStr()
- self.saveBtn.setTitle("Save".da_localizedStr(), for: .normal)
- backBtn.setTitle("Back".da_localizedStr(), for: .normal)
- placeHolderLabel.text = "Please_setup_the_export_fliename".da_localizedStr()
- shareButton.setTitle("share".da_localizedStr(), for: .normal)
-
- self.textBox.layer.masksToBounds = true
- self.textBox.layer.cornerRadius = 5
- self.textBox.layer.borderColor = UIColor(hexString: "#C6C6C6")?.cgColor
- self.textBox.layer.borderWidth = 1
-
- textfield.clearButtonMode = .always
- textfield.delegate = self;
- self.box.layer.masksToBounds = true
- self.box.layer.cornerRadius = 5
- self.saveBtn.layer.masksToBounds = true
- self.saveBtn.layer.cornerRadius = 20
-
- let bgLayer2 = CAGradientLayer()
- bgLayer2.colors = [UIColor(red: 1, green: 0.52, blue: 0.07, alpha: 1).cgColor, UIColor(red: 1, green: 0.67, blue: 0, alpha: 1).cgColor]
- bgLayer2.locations = [0, 1]
- bgLayer2.frame = self.shareButton.bounds
- bgLayer2.startPoint = CGPoint(x: 1, y: 1)
- bgLayer2.endPoint = CGPoint(x: 0, y: 0)
- self.shareButton.layer.addSublayer(bgLayer2)
-
- let bgLayer3 = CAGradientLayer()
- bgLayer3.colors = [UIColor(red: 1, green: 0.52, blue: 0.07, alpha: 1).cgColor, UIColor(red: 1, green: 0.67, blue: 0, alpha: 1).cgColor]
- bgLayer3.locations = [0, 1]
- bgLayer3.frame = self.saveBtn.bounds
- bgLayer3.startPoint = CGPoint(x: 1, y: 1)
- bgLayer3.endPoint = CGPoint(x: 0, y: 0)
- self.saveBtn.layer.addSublayer(bgLayer3)
- }
-
- func textFieldDidEndEditing(_ textField: UITextField) {
- if textField.text!.count > 6 {
- //g_showHUD("文件名称不能超过六个字")
- // return
- }
- }
- }
|