Commit 6fe41933 authored by lujunye's avatar lujunye

点击看大图

parent e6906032
...@@ -13,10 +13,12 @@ protocol AddImgCellDelegate { ...@@ -13,10 +13,12 @@ protocol AddImgCellDelegate {
func AddImgCellBtnClick(cell:AddImgCell) func AddImgCellBtnClick(cell:AddImgCell)
func DelImgCellBtnClick(sender:UIButton,cell:AddImgCell) func DelImgCellBtnClick(sender:UIButton,cell:AddImgCell)
func ChangeCellBtnClick(sender:UIButton,cell:AddImgCell) func ChangeCellBtnClick(sender:UIButton,cell:AddImgCell)
func CheckCellBtnClick(sender:UIButton,cell:AddImgCell)
} }
class AddImgCell: UITableViewCell { class AddImgCell: UITableViewCell {
var delegate:AddImgCellDelegate? var delegate:AddImgCellDelegate?
var isAllEditing = true var isAllEditing = true
var isEdit:Bool?{ var isEdit:Bool?{
willSet{ willSet{
isEdit = newValue isEdit = newValue
...@@ -25,6 +27,7 @@ class AddImgCell: UITableViewCell { ...@@ -25,6 +27,7 @@ class AddImgCell: UITableViewCell {
} }
} }
} }
@IBAction func btnClick(_ sender: Any) { @IBAction func btnClick(_ sender: Any) {
if isAllEditing { if isAllEditing {
delegate?.AddImgCellBtnClick(cell: self) delegate?.AddImgCellBtnClick(cell: self)
...@@ -119,8 +122,6 @@ class AddImgCell: UITableViewCell { ...@@ -119,8 +122,6 @@ class AddImgCell: UITableViewCell {
make.width.height.equalTo(90) make.width.height.equalTo(90)
make.left.equalTo(105*i) make.left.equalTo(105*i)
} }
if isAllEditing { if isAllEditing {
let changeBtn = UIButton() let changeBtn = UIButton()
changeBtn.tag = i changeBtn.tag = i
...@@ -161,9 +162,32 @@ class AddImgCell: UITableViewCell { ...@@ -161,9 +162,32 @@ class AddImgCell: UITableViewCell {
make.width.height.equalTo(25) make.width.height.equalTo(25)
} }
delBtn.addTarget(self, action: #selector(delAction(sender:)), for: .touchUpInside) delBtn.addTarget(self, action: #selector(delAction(sender:)), for: .touchUpInside)
}else{
let checkBtn = UIButton()
checkBtn.tag = i
checkBtn.backgroundColor = UIColor(named: "标题字颜色")
checkBtn.alpha = 0.5
checkBtn.addTarget(self, action: #selector(checkAction(sender:)), for: .touchUpInside)
img.addSubview(checkBtn)
checkBtn.snp.makeConstraints { (make) in
make.top.bottom.right.left.equalTo(0)
}
let tit = UILabel()
tit.text = "查 看"
tit.textColor = UIColor.white
tit.textAlignment = .center
tit.font = UIFont.systemFont(ofSize: 15)
img.addSubview(tit)
tit.snp.makeConstraints { (make) in
make.top.bottom.right.left.equalTo(0)
}
} }
} }
} }
@objc func checkAction(sender:UIButton){
delegate?.CheckCellBtnClick(sender: sender,cell:self)
}
@objc func changeAction(sender:UIButton){ @objc func changeAction(sender:UIButton){
if isAllEditing { if isAllEditing {
delegate?.ChangeCellBtnClick(sender: sender,cell:self) delegate?.ChangeCellBtnClick(sender: sender,cell:self)
......
<?xml version="1.0" encoding="UTF-8"?> <?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="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
...@@ -17,6 +17,25 @@ protocol EPViewControllerDelegate { ...@@ -17,6 +17,25 @@ protocol EPViewControllerDelegate {
} }
class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate, LMNoteViewControllerDelegate,GeliAlertViewDelegate{ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate, LMNoteViewControllerDelegate,GeliAlertViewDelegate{
func CheckCellBtnClick(sender: UIButton, cell: AddImgCell) {
let browser = JXPhotoBrowser()
print(sender.tag,cell.imgs.count)
browser.numberOfItems = {
cell.imgs.count
}
browser.reloadCellAtIndex = { context in
let browserCell = context.cell as? JXPhotoBrowserImageCell
let indexPath = IndexPath(item: context.index, section: 0)
browser.pageIndex = indexPath.item
let url = URL(string:SERVERCE_ImageHost + cell.imgs[browser.pageIndex])
browserCell?.imageView.sd_setImage(with: url, placeholderImage: nil, options: [], completed: { (_, _, _, _) in
browserCell?.setNeedsLayout()
})
}
browser.show()
}
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
var delegate:EPViewControllerDelegate? var delegate:EPViewControllerDelegate?
......
...@@ -18,6 +18,10 @@ protocol ProductDetailViewControllerDelegate { ...@@ -18,6 +18,10 @@ protocol ProductDetailViewControllerDelegate {
} }
class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate,LMNoteViewControllerDelegate, GeliAlertViewDelegate{ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate,LMNoteViewControllerDelegate, GeliAlertViewDelegate{
func CheckCellBtnClick(sender: UIButton, cell: AddImgCell) {
}
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
var delegate :ProductDetailViewControllerDelegate? var delegate :ProductDetailViewControllerDelegate?
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) { func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
......
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