Commit 7374c551 authored by lujunye's avatar lujunye

车型显示,选择完成

parent 5a944b55
{
"images" : [
{
"filename" : "dot.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dot@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dot@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ll.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ll@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ll@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "rr.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "rr@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "rr@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "xx.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "xx@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "xx@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -185,8 +185,6 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -185,8 +185,6 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
print("aksldf == ",adrDatas?.count)
let searchBr = SearchBarView.init() let searchBr = SearchBarView.init()
navBgView.addSubview(searchBr) navBgView.addSubview(searchBr)
searchBr.snp.makeConstraints { (make) in searchBr.snp.makeConstraints { (make) in
...@@ -212,18 +210,15 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -212,18 +210,15 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
AMapServices.shared().apiKey = "ca417b43e3d031db9c29382cc09a174a" AMapServices.shared().apiKey = "ca417b43e3d031db9c29382cc09a174a"
if lat == 0 && lng == 0 {
manger.delegate = self manger.delegate = self
manger.requestAlwaysAuthorization() manger.requestAlwaysAuthorization()
manger.requestWhenInUseAuthorization() manger.requestWhenInUseAuthorization()
manger.startUpdatingLocation() manger.startUpdatingLocation()
}
initMapView() initMapView()
initSearch() initSearch()
searchList.layer.cornerRadius = 5 searchList.layer.cornerRadius = 5
searchList.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner,CACornerMask.layerMaxXMinYCorner] searchList.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner,CACornerMask.layerMaxXMinYCorner]
searchList.register(UINib(nibName: "HuoLaLaDiZhiCell", bundle: nil), forCellReuseIdentifier: "HuoLaLaDiZhiCell") searchList.register(UINib(nibName: "HuoLaLaDiZhiCell", bundle: nil), forCellReuseIdentifier: "HuoLaLaDiZhiCell")
...@@ -231,7 +226,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -231,7 +226,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
nameTF.text = nameStr nameTF.text = nameStr
phoneTF.text = phoneNum phoneTF.text = phoneNum
addressDetailTF.text = adrStr addressDetailTF.text = adrStr
print("8")
} }
func initMapView(){ func initMapView(){
...@@ -243,11 +238,11 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -243,11 +238,11 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
self.mapView.centerCoordinate = CLLocationCoordinate2DMake(lat,lng) self.mapView.centerCoordinate = CLLocationCoordinate2DMake(lat,lng)
print("==",lat,lng)
MapBgView.addSubview(mapView!) MapBgView.addSubview(mapView!)
let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard)) let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard))
mapView.addGestureRecognizer(tap) mapView.addGestureRecognizer(tap)
print("4")
} }
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
...@@ -271,7 +266,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -271,7 +266,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
search.delegate = self search.delegate = self
let request = AMapPOIAroundSearchRequest() let request = AMapPOIAroundSearchRequest()
//地址 //地址
print("5")
request.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude)) request.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude))
request.requireExtension = true request.requireExtension = true
search.aMapPOIAroundSearch(request) search.aMapPOIAroundSearch(request)
...@@ -319,7 +314,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -319,7 +314,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
// response.pois.forEach { (poi) in // response.pois.forEach { (poi) in
// adrArr.append(poi) // adrArr.append(poi)
// } // }
print("run",response.pois.first?.location.latitude)
if introView == nil { if introView == nil {
introView = UIView() introView = UIView()
MapBgView.addSubview(introView!) MapBgView.addSubview(introView!)
...@@ -353,9 +348,9 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -353,9 +348,9 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
paraph.lineSpacing = 3 paraph.lineSpacing = 3
var str = "\(String(describing: response.pois.first!.province!))\(String(describing: response.pois.first!.city!))\(String(describing: response.pois.first!.district!))\( String(describing: response.pois.first!.address!))" var str = "\(String(describing: response.pois.first!.province!))\(String(describing: response.pois.first!.city!))\(String(describing: response.pois.first!.district!))\( String(describing: response.pois.first!.address!))"
print("test11")
if adrName.count > 0 { if adrName.count > 0 {
print("test12")
isMove = true isMove = true
titleLbl!.text = adrName titleLbl!.text = adrName
str = detailAdr str = detailAdr
...@@ -435,11 +430,11 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -435,11 +430,11 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
adrName = "" adrName = ""
detailAdr = "" detailAdr = ""
} }
print("CLLocationDegrees = ",mapView.centerCoordinate.latitude,lat,CGFloat(mapView.centerCoordinate.latitude))
req.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude)) req.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude))
req.requireExtension = true req.requireExtension = true
search.aMapPOIAroundSearch(req) search.aMapPOIAroundSearch(req)
print("6")
} }
...@@ -449,7 +444,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -449,7 +444,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
let request = AMapReGeocodeSearchRequest() let request = AMapReGeocodeSearchRequest()
request.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude)) request.location = AMapGeoPoint.location(withLatitude: CGFloat(mapView.centerCoordinate.latitude), longitude: CGFloat(mapView.centerCoordinate.longitude))
print("7",mapView.centerCoordinate.latitude)
search.aMapReGoecodeSearch(request) search.aMapReGoecodeSearch(request)
request.requireExtension = true request.requireExtension = true
......
...@@ -7,9 +7,15 @@ ...@@ -7,9 +7,15 @@
// //
import UIKit import UIKit
import SDWebImage
protocol HLLTopCellDelegate {
func HLLTopCellBtnClick(idx:Int)
func HLLTopCellScrollIdx(idx:Int)
}
class HLLTopCell: UITableViewCell,UIScrollViewDelegate { class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
var idx = 0 var idx = 0
var delegate:HLLTopCellDelegate?
@IBAction func btnClick(_ sender: UIButton) { @IBAction func btnClick(_ sender: UIButton) {
leftBtn.isHidden = false leftBtn.isHidden = false
rightBtn.isHidden = false rightBtn.isHidden = false
...@@ -31,13 +37,26 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -31,13 +37,26 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
} }
scrollView?.setContentOffset(CGPoint(x: scViewBg.bounds.size.width * CGFloat(idx), y: (scrollView?.frame.origin.y)!), animated: true) scrollView?.setContentOffset(CGPoint(x: scViewBg.bounds.size.width * CGFloat(idx), y: (scrollView?.frame.origin.y)!), animated: true)
delegate?.HLLTopCellBtnClick(idx: idx)
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let isStop = !scrollView.isTracking && !scrollView.isDragging && !scrollView.isDecelerating
if isStop {
var idx:Int = Int(scrollView.contentOffset.x/scViewBg.bounds.size.width)
if idx < 0 {
idx = 0
}
if idx > datas.count - 1 {
idx = datas.count - 1
}
delegate?.HLLTopCellScrollIdx(idx:idx)
}
} }
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
leftBtn.isHidden = false leftBtn.isHidden = false
rightBtn.isHidden = false rightBtn.isHidden = false
if scrollView.contentOffset.x/scViewBg.bounds.size.width <= 0 { if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 {
leftBtn.isHidden = true leftBtn.isHidden = true
} }
let num = datas.count - 1 let num = datas.count - 1
...@@ -46,7 +65,17 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -46,7 +65,17 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
rightBtn.isHidden = true rightBtn.isHidden = true
} }
var numIdx = Int(scrollView.contentOffset.x/scViewBg.bounds.size.width - 1)
if numIdx < 0 {
numIdx = 0
}
if numIdx > num {
numIdx = num
}
let model = datas[numIdx]
weightLbl.text = model.vehicle_price_text_item?.text_weight
sizeLbl.text = model.vehicle_price_text_item?.text_size
tjLbl.text = model.vehicle_price_text_item?.text_volume
} }
@IBOutlet weak var rightBtn: UIButton! @IBOutlet weak var rightBtn: UIButton!
...@@ -56,7 +85,21 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -56,7 +85,21 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
@IBOutlet weak var sizeLbl: UILabel! @IBOutlet weak var sizeLbl: UILabel!
@IBOutlet weak var weightLbl: UILabel! @IBOutlet weak var weightLbl: UILabel!
var datas:Array<String> = [] var datas:Array<vehicle_arr_data> = []{
didSet{
if datas.count < 2 {
rightBtn.isHidden = true
}else{
rightBtn.isHidden = false
}
if datas.count > 0 {
let model = datas[idx]
weightLbl.text = model.vehicle_price_text_item?.text_weight
sizeLbl.text = model.vehicle_price_text_item?.text_size
tjLbl.text = model.vehicle_price_text_item?.text_volume
}
}
}
var scrollView:UIScrollView? var scrollView:UIScrollView?
override func awakeFromNib() { override func awakeFromNib() {
...@@ -65,33 +108,51 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -65,33 +108,51 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
leftBtn.isHidden = true leftBtn.isHidden = true
self.selectionStyle = .none self.selectionStyle = .none
}
}
override func layoutIfNeeded() { override func layoutIfNeeded() {
super.layoutIfNeeded() super.layoutIfNeeded()
if scrollView == nil {
scrollView = UIScrollView(frame: scViewBg.bounds) scrollView = UIScrollView(frame: scViewBg.bounds)
scViewBg.addSubview(scrollView!) scViewBg.addSubview(scrollView!)
scrollView?.isPagingEnabled = true scrollView?.isPagingEnabled = true
scrollView?.showsHorizontalScrollIndicator = false scrollView?.showsHorizontalScrollIndicator = false
scrollView?.delegate = self scrollView?.delegate = self
}
if (scrollView?.subviews.count)! > 0 && scrollView != nil {
for item in scrollView!.subviews {
item.removeFromSuperview()
}
}
let num = datas.count
var num = datas.count
scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(num), height: (scViewBg.bounds.size.height)) scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(num), height: (scViewBg.bounds.size.height))
for i in 0 ..< num{ for i in 0 ..< num{
let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height)) let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height))
if i % 2 == 0 { let model = datas[i]
view.backgroundColor = UIColor.blue let imgV = UIImageView()
}else{ view.addSubview(imgV)
view.backgroundColor = UIColor.red SDWebImageDownloader.shared.downloadImage(with: URL(string:model.img_url_high_light!), options: .continueInBackground, progress: { (a, b, nil) in
}) { (img, data, err, true) in
imgV.image = img
if img != nil {
let p = self.scViewBg.bounds.size.width / (img!.size.width)
imgV.snp.makeConstraints { (make) in
make.width.equalTo((imgV.image?.size.width)! * p * 0.6)
make.height.equalTo((imgV.image?.size.height)! * p * 0.5)
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}
} }
scrollView?.addSubview(view) scrollView?.addSubview(view)
} }
} }
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
......
...@@ -87,26 +87,28 @@ ...@@ -87,26 +87,28 @@
<constraint firstAttribute="trailing" secondItem="dcU-lR-ZVX" secondAttribute="trailing" constant="53.5" id="zbV-6L-D7f"/> <constraint firstAttribute="trailing" secondItem="dcU-lR-ZVX" secondAttribute="trailing" constant="53.5" id="zbV-6L-D7f"/>
</constraints> </constraints>
</view> </view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z6t-TU-kTM"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z6t-TU-kTM">
<rect key="frame" x="332" y="59" width="28" height="28"/> <rect key="frame" x="332" y="59" width="28" height="28"/>
<color key="backgroundColor" red="0.29803921570000003" green="0.34901960780000002" blue="0.50196078430000002" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="28" id="w4n-ZK-J9g"/> <constraint firstAttribute="width" constant="28" id="w4n-ZK-J9g"/>
<constraint firstAttribute="height" constant="28" id="yl6-Gd-YKI"/> <constraint firstAttribute="height" constant="28" id="yl6-Gd-YKI"/>
</constraints> </constraints>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="rr"/>
<connections> <connections>
<action selector="btnClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="uz8-x4-Svq"/> <action selector="btnClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="uz8-x4-Svq"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lc5-Gn-jWh"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lc5-Gn-jWh">
<rect key="frame" x="15" y="59" width="28" height="28"/> <rect key="frame" x="15" y="59" width="28" height="28"/>
<color key="backgroundColor" red="0.44705882349999998" green="0.39607843139999999" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="28" id="HYU-ly-9UX"/> <constraint firstAttribute="width" constant="28" id="HYU-ly-9UX"/>
<constraint firstAttribute="height" constant="28" id="Wpx-pa-nSQ"/> <constraint firstAttribute="height" constant="28" id="Wpx-pa-nSQ"/>
</constraints> </constraints>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="ll"/>
<connections> <connections>
<action selector="btnClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="xNF-PS-V1Q"/> <action selector="btnClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="xNF-PS-V1Q"/>
</connections> </connections>
...@@ -146,6 +148,8 @@ ...@@ -146,6 +148,8 @@
</tableViewCell> </tableViewCell>
</objects> </objects>
<resources> <resources>
<image name="ll" width="9.5" height="28"/>
<image name="rr" width="9.5" height="28"/>
<namedColor name="标题字颜色"> <namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
......
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