Commit e574e7d7 authored by lujunye's avatar lujunye

sdfsadfasdf323234234

parent 11aa1dd7
......@@ -300,7 +300,7 @@ class getVehicleTypeData_model: Mappable {
var truckVolume : String? //体积
var img :String?//图片
var truckWeight:Float?//载重
var truckWeight:String?//载重
var name : String?
var istailplate :Int? //是否有尾板车型0没有尾板1有尾板
......
......@@ -23,6 +23,8 @@
<outlet property="listView" destination="Try-UC-8fP" id="plR-El-hxN"/>
<outlet property="p_p_view" destination="Vf0-aT-43t" id="BMv-xY-6z5"/>
<outlet property="pin_pin_huo" destination="hwI-gN-CwU" id="xHH-Jp-k0u"/>
<outlet property="pph_listView" destination="lrw-DF-qzM" id="QG0-fE-TaJ"/>
<outlet property="pph_topCarBtnView" destination="dYD-zk-l4l" id="D3e-D2-pIT"/>
<outlet property="priceLbl" destination="TJP-xc-KTh" id="NH7-PB-8a7"/>
<outlet property="rightBtn" destination="X6m-t6-gdl" id="yiF-bx-dJm"/>
<outlet property="topBtnView" destination="3NL-zo-jTU" id="7XJ-gu-PcZ"/>
......@@ -506,6 +508,10 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lrw-DF-qzM">
<rect key="frame" x="0.0" y="44" width="414" height="636"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="hRD-SE-jP6"/>
<outlet property="delegate" destination="-1" id="pH6-qu-Y2h"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="白色背景色"/>
......
......@@ -12,7 +12,7 @@ import SDWebImage
protocol HLLTopCellDelegate {
func HLLTopCellBtnClick(idx:Int)
func HLLTopCellScrollIdx(idx:Int)
// func HLLTopCellOtherClick(isSelect:Bool)
// func HLLTopCellOtherClick(isSelect:Bool)
}
class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
var idx = 0
......@@ -62,8 +62,40 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
leftBtn.isHidden = false
rightBtn.isHidden = false
if isPPH {
if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 {
leftBtn.isHidden = true
}
let num = pph_datas.count - 1
if scrollView.contentOffset.x/scViewBg.bounds.size.width >= CGFloat(num) {
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 = pph_datas[numIdx]
if pph_datas.count > 0 {
if model.truckWeight != nil {
weightLbl.text = model.truckWeight
}
if model.cubage != nil {
sizeLbl.text = "\(model.cubage!)"
}
tjLbl.text = model.truckVolume
}
}else{
if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 {
leftBtn.isHidden = true
}
......@@ -80,6 +112,7 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
if numIdx > num {
numIdx = num
}
if datas.count > 0 {
let model = datas[numIdx]
if (model.vehicle_price_text_item!.text_weight!.contains("/")){
let arr = model.vehicle_price_text_item?.text_weight?.components(separatedBy: "/")
......@@ -90,7 +123,8 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
sizeLbl.text = model.vehicle_price_text_item?.text_size
tjLbl.text = model.vehicle_price_text_item?.text_volume
}
}
}
@IBOutlet weak var rightBtn: UIButton!
......@@ -99,7 +133,25 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
@IBOutlet weak var tjLbl: UILabel!
@IBOutlet weak var sizeLbl: UILabel!
@IBOutlet weak var weightLbl: UILabel!
var pph_datas:Array<getVehicleTypeData_model> = []{
didSet{
if pph_datas.count < 2 {
rightBtn.isHidden = true
}else{
rightBtn.isHidden = false
}
if pph_datas.count > 0 {
let model = pph_datas[idx]
if model.truckWeight != nil {
weightLbl.text = model.truckWeight
}
if model.cubage != nil {
sizeLbl.text = "\(model.cubage!)"
}
tjLbl.text = model.truckVolume
}
}
}
var datas:Array<vehicle_arr_data> = []{
didSet{
if datas.count < 2 {
......@@ -124,10 +176,59 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
self.selectionStyle = .none
}
var isPPH = false
override func layoutIfNeeded() {
super.layoutIfNeeded()
if isPPH {
if scrollView == nil {
scrollView = UIScrollView(frame: scViewBg.bounds)
scViewBg.addSubview(scrollView!)
scrollView?.isPagingEnabled = true
scrollView?.showsHorizontalScrollIndicator = false
scrollView?.delegate = self
}
if (scrollView?.subviews.count)! > 0 && scrollView != nil {
for item in scrollView!.subviews {
item.removeFromSuperview()
}
}
let num = pph_datas.count
scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(num), height: (scViewBg.bounds.size.height))
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 model = pph_datas[i]
let imgV = UIImageView()
view.addSubview(imgV)
SDWebImageDownloader.shared.downloadImage(with: URL(string:model.img!), 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)
}
}else{
imgV.image = UIImage(named: "lmn_tool_image")
imgV.snp.makeConstraints { (make) in
make.width.equalTo(self.scViewBg.bounds.size.width)
make.height.equalTo(self.scViewBg.bounds.size.height)
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}
}
scrollView?.addSubview(view)
}
return
}
if scrollView == nil {
scrollView = UIScrollView(frame: scViewBg.bounds)
scViewBg.addSubview(scrollView!)
......@@ -149,7 +250,6 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
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 model = datas[i]
let imgV = UIImageView()
// imgV.image =
view.addSubview(imgV)
......
......@@ -14,6 +14,9 @@ class OnlyViewCell: UITableViewCell {
var delegate:OnlyViewCellDelegate?
@IBOutlet weak var btnViewH: NSLayoutConstraint!
var datas:Array<vehicle_std_arr_data>?
var isPPH = false
var pph_datas:Array<getVehicleTypeData_model>?
@IBOutlet weak var btnView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
......@@ -24,6 +27,36 @@ class OnlyViewCell: UITableViewCell {
var isNotReady:Bool = true
override func layoutSubviews() {
super.layoutSubviews()
if isPPH {
if isNotReady {
for index in 0 ..< pph_datas!.count{
let item = pph_datas![index]
let width = fullScreenWidth - 30
let w = width / 3
let cols = 3
let col = index % cols
let row = index / cols
let shopX = CGFloat(col) * (w + 10)
let shopY = CGFloat(row) * (20 + 5)
let btn = UIButton(frame: CGRect(x: shopX , y: shopY , width: w, height: 20))
btn.setImage(UIImage(named: "daixuan"), for: .normal)
btn.setImage(UIImage(named: "yuxuan"), for: .selected)
btn.addTarget(self, action: #selector(carSelect(sender:)), for: .touchUpInside)
btn.tag = index
btn.setTitle(" " + item.name!, for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 11)
btn.setTitleColor(UIColor(named: "灰色字体颜色"), for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btnView.addSubview(btn)
if index == pph_datas!.count - 1 {
btnViewH.constant = shopY+20
isNotReady = false
}
}
}
}else{
if isNotReady {
for index in 0 ..< datas!.count{
let item = datas![index]
......@@ -52,7 +85,7 @@ class OnlyViewCell: UITableViewCell {
}
}
}
}
}
@objc func carSelect(sender:UIButton){
if sender.isSelected {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -29,7 +30,7 @@
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iu3-IV-bvt">
<rect key="frame" x="15" y="35" width="328" height="20"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="Em9-Te-Ur4"/>
</constraints>
......@@ -57,5 +58,8 @@
<namedColor name="提示语字体颜色">
<color red="0.70588235294117652" green="0.70588235294117652" blue="0.70588235294117652" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
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