| | |
| | | return image |
| | | }() |
| | | |
| | | let mapView = YYMapViewManager.share.mapView |
| | | let mapView: MAMapView = { |
| | | let view = MAMapView() |
| | | view.mapType = .standard |
| | | view.showsUserLocation = true // YES 为打开定位,NO为关闭定位 |
| | | view.zoomLevel = 17 |
| | | view.isRotateCameraEnabled = false |
| | | view.isRotateEnabled = false |
| | | view.userTrackingMode = .follow |
| | | view.pausesLocationUpdatesAutomatically = false |
| | | view.allowsBackgroundLocationUpdates = true |
| | | view.isRotateEnabled = false |
| | | view.showsCompass = false |
| | | view.showsScale = false |
| | | return view |
| | | }() |
| | | |
| | | private var manager: LocationSearchManager = LocationSearchManager() |
| | | |
| | |
| | | super.viewDidLoad() |
| | | textField_search.delegate = self |
| | | manager.searchDelegate = self |
| | | view_desc.isHidden = !origin.value |
| | | mapView.delegate = self |
| | | } |
| | | |
| | | //MARK: - Rx |
| | |
| | | |
| | | YYMapViewManager.share.originInfo.subscribe(onNext: {[unowned self]info in |
| | | if let name = info?.name{ |
| | | self.textField_search.text = name |
| | | self.manager.startPoiSearch(keyword: name, city: self.cityName) |
| | | // self.textField_search.text = name |
| | | // self.manager.startPoiSearch(keyword: name, city: self.cityName) |
| | | } |
| | | }).disposed(by: rx.disposeBag) |
| | | } |
| | |
| | | return true |
| | | } |
| | | } |
| | | |
| | | //MARK: - MAMapViewDelegate |
| | | extension SearchAddressDragVC: MAMapViewDelegate |
| | | { |
| | | // func mapView(_ mapView: MAMapView!, regionDidChangeAnimated animated: Bool) { |
| | | // |
| | | // } |
| | | |
| | | func mapView(_ mapView: MAMapView!, mapWillMoveByUser wasUserAction: Bool) { |
| | | |
| | | } |
| | | |
| | | func mapView(_ mapView: MAMapView!, mapDidMoveByUser wasUserAction: Bool) { |
| | | guard wasUserAction else {return} |
| | | let coordinate = mapView.centerCoordinate |
| | | manager.startReverseSearch(lat: coordinate.latitude, lng: coordinate.longitude) |
| | | } |
| | | } |
| | | |
| | | |