| | |
| | | |
| | | class CityChooseSubTypeView: UIView,JQNibView{ |
| | | @IBOutlet weak var cons_viewHeight: NSLayoutConstraint! |
| | | @IBOutlet weak var label_city: UILabel! |
| | | private var closeClouse:(()->Void)? |
| | | private var clouse:((String)->Void)? |
| | | |
| | |
| | | cons_viewHeight.constant = 100 |
| | | alpha = 0 |
| | | layoutIfNeeded() |
| | | startLocation() |
| | | } |
| | | |
| | | |
| | | static func show(inView:UIView,afterView:UIView,clouse:@escaping (String)->Void,closeClouse:@escaping ()->Void){ |
| | | @discardableResult |
| | | static func show(inView:UIView,afterView:UIView,clouse:@escaping (String)->Void,closeClouse:@escaping ()->Void)->CityChooseSubTypeView{ |
| | | let subTypeView = CityChooseSubTypeView.jq_loadNibView() |
| | | subTypeView.closeClouse = closeClouse |
| | | subTypeView.clouse = clouse |
| | |
| | | subTypeView.layoutIfNeeded() |
| | | } |
| | | } |
| | | return subTypeView |
| | | } |
| | | |
| | | |
| | |
| | | self.closeClouse!() |
| | | } |
| | | } |
| | | |
| | | private func startLocation(){ |
| | | locationTool.startLocation { location in |
| | | locationTool.geocoder(location) { [weak self] marks, error in |
| | | self?.label_city.text = marks?.last?.locality ?? "定位失败" |
| | | locationTool.stopLocation() |
| | | } |
| | | } errorClouse: { error in |
| | | locationTool.stopLocation() |
| | | } |
| | | } |
| | | |
| | | @IBAction func reLocationAction(_ sender: Any) { |
| | | startLocation() |
| | | } |
| | | } |