Commit 0329f2d4 authored by lujunye's avatar lujunye

sadfsadfsafasfd332323232324

parent b7881fe0
......@@ -39,12 +39,14 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
func SJMapViewControllerSelectArd(adr:String,cityData:String,loc:String) {
city_lbl.text = cityData
adrLast = adr.components(separatedBy: ":").last!
adrTf.text = adr.components(separatedBy: ":").first!
adrTv.text = adr.components(separatedBy: ":").first!
adrTf.isHidden = true
getInsets()
let ar = loc.components(separatedBy: "-")
self.lng = (ar.last! as NSString).doubleValue
self.lat = (ar.first! as NSString).doubleValue
checkInfo()
}
......@@ -55,10 +57,10 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
HUD.flash(.label("请选择地址"), delay: 1.2)
return
}
// if phoneTf.text?.count != 11 {
// HUD.flash(.label("请输入正确的手机号码"), delay: 1.2)
// return
// }
// if phoneTf.text?.count != 11 {
// HUD.flash(.label("请输入正确的手机号码"), delay: 1.2)
// return
// }
var type = 3
if isSend {
type = 4
......@@ -67,7 +69,7 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
"province_name":arr[0] as Any,
"city_name":arr[1] as Any,
"district_name":arr[2] as Any,
"address":adrTf.text as Any,
"address":adrTv.text as Any,
"linkman":nameTf.text as Any,
"shopName":city_lbl.text as Any,
"mobile":phoneTf.text as Any,
......@@ -84,7 +86,7 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
nameTf.resignFirstResponder()
phoneTf.resignFirstResponder()
textTV.resignFirstResponder()
adrTf.resignFirstResponder()
adrTv.resignFirstResponder()
let vc = SJMapViewController()
vc.delegate = self
vc.isPPH = true
......@@ -133,24 +135,36 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
}
func textViewDidChange(_ textView: UITextView) {
if textView.text.count != 0 {
holder_lbl.isHidden = true
if textView == textTV {
if textView.text.count != 0 {
holder_lbl.isHidden = true
}else{
holder_lbl.isHidden = false
}
if textView.text.count > 200 {
if let str = textView.text {
let subStr = str.prefix(200)
textView.text = String(subStr)
}
}
count_lbl.text = "\(textView.text.count)/200"
}else{
holder_lbl.isHidden = false
}
if textView.text.count > 200 {
if let str = textView.text {
let subStr = str.prefix(200)
textView.text = String(subStr)
if textView.text.count != 0 {
adrTf.isHidden = true
}else{
adrTf.isHidden = false
}
getInsets()
}
count_lbl.text = "\(textView.text.count)/200"
checkInfo()
}
@IBOutlet weak var adrTv: UITextView!
@IBOutlet weak var clearBtn: UIButton!
@IBAction func clearAction(_ sender: Any) {
adrTf.text = ""
adrTv.text = ""
getInsets()
phoneTf.text = ""
nameTf.text = ""
city_lbl.text = "请选择城市"
......@@ -171,14 +185,14 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
@IBOutlet weak var holder_lbl: UILabel!
func checkInfo(){
if adrTf.text?.count != 0 && phoneTf.text?.count != 0 && nameTf.text?.count != 0 && city_lbl.text != "请选择城市" {
if adrTv.text?.count != 0 && phoneTf.text?.count != 0 && nameTf.text?.count != 0 && city_lbl.text != "请选择城市" {
submit_btn.isUserInteractionEnabled = true
submit_btn.alpha = 1
}else{
submit_btn.isUserInteractionEnabled = false
submit_btn.alpha = 0.5
}
if adrTf.text?.count != 0 || phoneTf.text?.count != 0 || nameTf.text?.count != 0 || textTV.text.count != 0 || city_lbl.text != "请选择城市" {
if adrTv.text?.count != 0 || phoneTf.text?.count != 0 || nameTf.text?.count != 0 || textTV.text.count != 0 || city_lbl.text != "请选择城市" {
clearBtn.isUserInteractionEnabled = true
clearBtn.alpha = 1
}else{
......@@ -198,7 +212,6 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
self.view.addSubview(navbar)
nameTf.addTarget(self, action: #selector(textChangeTf(tf:)), for: .allEditingEvents)
phoneTf.addTarget(self, action: #selector(textChangeTf(tf:)), for: .allEditingEvents)
adrTf.addTarget(self, action: #selector(textChangeTf(tf:)), for: .allEditingEvents)
top_view.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height+10)
......@@ -214,7 +227,8 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
if adrInfo != nil {
city_lbl.text = adrInfo?.shopName
textTV.text = adrInfo?.note
adrTf.text = adrInfo?.address
adrTv.text = adrInfo?.address
getInsets()
nameTf.text = adrInfo?.linkman
phoneTf.text = adrInfo?.mobile
lat = adrInfo!.lat!
......@@ -225,10 +239,11 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
}
checkInfo()
}
func getIndex(){
let path = Bundle.main.path(forResource: "address_new", ofType: "json")
let url = URL(fileURLWithPath: path!)
......@@ -402,5 +417,17 @@ class P_P_H_Adr_VC: BaseViewController,SJMapViewControllerDelegate, UIPickerView
return genderLbl
}
@IBOutlet weak var adrCenterY: NSLayoutConstraint!
func textSize(text : String , font : UIFont , maxSize : CGSize) -> CGSize{
return text.boundingRect(with: maxSize, options: [.usesLineFragmentOrigin], attributes: [NSAttributedString.Key.font : font], context: nil).size
}
func getInsets() {
let tvSize = textSize(text: adrTv.text, font: UIFont.systemFont(ofSize: 13), maxSize: CGSize(width: adrTv.bounds.size.width, height: 900))
if tvSize.height > 20 {
adrCenterY.constant = -2
}else{
adrCenterY.constant = 4
}
}
}
......@@ -12,7 +12,9 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="P_P_H_Adr_VC" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="adrCenterY" destination="9HD-uo-omN" id="NZs-VH-0Ey"/>
<outlet property="adrTf" destination="c79-WN-La1" id="lqQ-rc-8Ck"/>
<outlet property="adrTv" destination="bWc-5F-zex" id="EAd-CQ-NBa"/>
<outlet property="city_lbl" destination="qSB-h2-bQB" id="IgF-C6-mjv"/>
<outlet property="clearBtn" destination="Sya-Y4-SHc" id="U7f-h0-3kb"/>
<outlet property="count_lbl" destination="Vv5-0g-G5Q" id="j8d-11-Hua"/>
......@@ -242,6 +244,16 @@
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="bWc-5F-zex">
<rect key="frame" x="70" y="157" width="299" height="42"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" name="标题字颜色"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<connections>
<outlet property="delegate" destination="-1" id="TJy-1W-7Fd"/>
</connections>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
......@@ -250,6 +262,8 @@
<constraint firstItem="oQW-zP-UrW" firstAttribute="centerY" secondItem="dTK-sv-cT8" secondAttribute="centerY" id="4lS-HU-K3Z"/>
<constraint firstItem="c79-WN-La1" firstAttribute="top" secondItem="VhN-lm-X43" secondAttribute="bottom" id="5NX-xb-1d4"/>
<constraint firstItem="c79-WN-La1" firstAttribute="centerY" secondItem="Vx9-sb-QcV" secondAttribute="centerY" id="6br-Od-oYY"/>
<constraint firstItem="bWc-5F-zex" firstAttribute="centerY" secondItem="c79-WN-La1" secondAttribute="centerY" constant="4" id="9HD-uo-omN"/>
<constraint firstItem="bWc-5F-zex" firstAttribute="width" secondItem="c79-WN-La1" secondAttribute="width" id="BNk-9F-2Op"/>
<constraint firstItem="Vx9-sb-QcV" firstAttribute="leading" secondItem="Hje-Lv-QT9" secondAttribute="leading" constant="10" id="DvD-1k-SgT"/>
<constraint firstItem="nEW-3u-jw2" firstAttribute="height" secondItem="LpS-hu-fke" secondAttribute="height" id="Ex8-eM-aU4"/>
<constraint firstItem="LpS-hu-fke" firstAttribute="leading" secondItem="Hje-Lv-QT9" secondAttribute="leading" id="HEg-Xk-gKb"/>
......@@ -265,6 +279,8 @@
<constraint firstAttribute="height" constant="200" id="fkG-O6-P7I"/>
<constraint firstItem="LpS-hu-fke" firstAttribute="top" secondItem="dTK-sv-cT8" secondAttribute="bottom" id="frC-Z2-eF2"/>
<constraint firstItem="dTK-sv-cT8" firstAttribute="leading" secondItem="Hje-Lv-QT9" secondAttribute="leading" constant="12.5" id="iv8-9u-5uT"/>
<constraint firstItem="bWc-5F-zex" firstAttribute="centerX" secondItem="c79-WN-La1" secondAttribute="centerX" constant="-5" id="jFo-9a-uqm"/>
<constraint firstItem="bWc-5F-zex" firstAttribute="height" secondItem="c79-WN-La1" secondAttribute="height" multiplier="0.8" id="mle-Gz-tZw"/>
<constraint firstItem="nEW-3u-jw2" firstAttribute="width" secondItem="LpS-hu-fke" secondAttribute="width" id="nlD-GX-D6o"/>
<constraint firstItem="VhN-lm-X43" firstAttribute="leading" secondItem="Hje-Lv-QT9" secondAttribute="leading" id="obE-bw-6AP"/>
<constraint firstItem="UWp-ld-fgy" firstAttribute="top" secondItem="Hje-Lv-QT9" secondAttribute="top" constant="13" id="pac-cV-Mrw"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment