Commit 0ad2729f authored by Steven杜宇's avatar Steven杜宇

// fix

parent 8050d6ac
......@@ -30,6 +30,9 @@ class YHNewProductCell: UITableViewCell {
func updateModel(_ model: YHSelectGoodsModel) {
self.imgView.sd_setImage(with: URL(string: model.image), placeholderImage: UIImage(named: "global_default_image"))
self.imgView.snp.updateConstraints { make in
make.height.equalTo(model.ratio * (KScreenWidth-20.0*2))
}
}
func setupUI() {
......
......@@ -127,6 +127,7 @@ extension YHSelectViewController {
head.block = { index in
self.selectItem = index
self.buttonItem = 0
self.tableView.reloadData()
self.updataData()
}
head.buttonBlock = { index in
......@@ -208,7 +209,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
let model = self.viewModel.goodsArray[indexPath.row]
if model.goodsCategoryType == 1 { // 新品商品
return 160
return UITableView.automaticDimension
}
if indexPath.row == 0 {
......@@ -218,6 +219,9 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if selectItem == 0 {
return 46
}
return 66
}
......@@ -227,6 +231,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
// headView.itemButton.setTitle(model.name, for: .normal)
// headView.itemButton.iconInRight(with: 0.5)
// }
return headView
}
......
......@@ -21,6 +21,7 @@ class YHSelectLookHeadView: UIView {
normalButton.isSelected = true
hotButton.isSelected = false
priceButton.isSelected = false
} else if buttonIndex == 1 {
normalButton.isSelected = false
hotButton.isSelected = true
......@@ -99,6 +100,7 @@ class YHSelectLookHeadView: UIView {
// button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(normalClick), for: .touchUpInside)
button.isSelected = true
button.isHidden = true
return button
}()
addSubview(normalButton)
......@@ -118,6 +120,7 @@ class YHSelectLookHeadView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected)
// button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(hotClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(hotButton)
......@@ -137,6 +140,7 @@ class YHSelectLookHeadView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(priceClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(priceButton)
......@@ -213,6 +217,14 @@ extension YHSelectLookHeadView: UICollectionViewDelegate, UICollectionViewDataSo
collectionView.reloadData()
if let block = block {
block(indexPath.row)
normalButton.isHidden = false
hotButton.isHidden = false
priceButton.isHidden = false
if indexPath.row == 0 {
normalButton.isHidden = true
hotButton.isHidden = true
priceButton.isHidden = true
}
}
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
}
......
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