Commit 9d9d2a91 authored by lujunye's avatar lujunye

商品详情

parent a72e7a59
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "shangchuantupian@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "shangchuantupian@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "xinzeng @2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "xinzeng @3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "xinzeng @2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "xinzeng @3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -20,8 +20,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Create the SwiftUI view that provides the window contents.
let contentView = LoginViewController()
let contentView = ProductDetailViewController()
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
......
This diff is collapsed.
This diff is collapsed.
......@@ -160,7 +160,7 @@
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
//
// AutoTextField.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
@objc protocol AutoTextFieldDelegate {
@objc optional func sendString(str:String)
@objc optional func sendHeight(height:CGFloat)
}
class AutoTextField: UITextView,UITextViewDelegate {
var tfDelegate:AutoTextFieldDelegate?
/// 占位文字颜色
var placeholderColor: UIColor? {
willSet {
self.placeholderLable.textColor = newValue ?? UIColor.lightGray
}
}
/// 占位文字
var placeholder: String? {
willSet {
self.placeholderLable.text = " " + (newValue ?? "")
}
}
/// 字体大小
var textFont: UIFont? {
willSet {
self.placeholderLable.font = newValue
self.font = newValue
}
}
/// 最小的高度
private var minHeight: CGFloat = 0.0
/// 初始化方法
///
/// - Parameters:
/// - frame: frame
/// - placeholder: 占位文字
convenience init(frame: CGRect, placeholder: String?) {
self.init(frame: frame, textContainer: nil)
self.minHeight = self.frame.height
// 设置字体
self.font = UIFont.systemFont(ofSize: 14.0)
if let placeholder = placeholder {
self.placeholderLable.text = " " + placeholder
}
// 添加边框
self.layer.borderWidth = 0.0
let num: CGFloat = 236.0 / 255.0
self.layer.borderColor = UIColor.init(red: num, green: num, blue: num, alpha: 1.0).cgColor
self.layer.cornerRadius = 5.0
self.clipsToBounds = true
self.delegate = self
}
/// 占位Label
private lazy var placeholderLable: UILabel = {
let label = UILabel.init(frame: CGRect.init(origin: CGPoint.init(x: 2.0, y: 0.0), size: self.frame.size))
label.textColor = UIColor.lightGray
label.font = self.font
self.addSubview(label)
return label
}()
func textViewDidChange(_ textView: UITextView) {
let text: String = textView.text!
self.placeholderLable.isHidden = true
tfDelegate?.sendString?(str: text)
if text.isEmpty {
var newFrame = self.placeholderLable.frame
newFrame.origin.y = 2.0
self.placeholderLable.frame = newFrame
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
self.placeholderLable.isHidden = false
}
return
}
// 计算文字高度
let height = self.getInputTextHeight(text: text)
if self.frame.height != height {
tfDelegate?.sendHeight?(height: height)
var newFrame = self.frame
newFrame.size.height = height
newFrame.origin.y -= (height - self.frame.height)
UIView.animate(withDuration: 0.3, animations: {
self.frame = newFrame
})
self.setContentOffset(CGPoint.init(x: 0.0, y: 4.0), animated: true)
}
}
/// 计算文字高度
///
/// - Parameters:
/// - text: 输入文字
/// - maxWidth: 最大宽度,控件宽度
/// - Returns: 文字高度
func getInputTextHeight(text: String) -> CGFloat {
if text.isEmpty {
return self.minHeight
}
let str = NSString.init(string: self.text)
let rect = str.boundingRect(with: CGSize.init(width: self.frame.width - 10.0, height: 999.0), options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font : self.font!], context: nil)
return max(rect.size.height + 13.0, self.minHeight)
}
}
//
// AddGuiGeCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class AddGuiGeCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="AddGuiGeCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="123.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="123.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FpT-RN-ad7">
<rect key="frame" x="148.5" y="21.5" width="78" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="jMA-bb-CP8"/>
<constraint firstAttribute="width" constant="78" id="zxB-d3-CDh"/>
</constraints>
<state key="normal" image="xinzeng "/>
</button>
</subviews>
<constraints>
<constraint firstItem="FpT-RN-ad7" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="CTD-cA-1jp"/>
<constraint firstAttribute="bottom" secondItem="FpT-RN-ad7" secondAttribute="bottom" constant="50" id="log-wz-xog"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="132" y="122"/>
</tableViewCell>
</objects>
<resources>
<image name="xinzeng " width="78" height="51.5"/>
</resources>
</document>
//
// AddImgCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class AddImgCell: UITableViewCell {
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var addBtn: UIButton!
@IBOutlet weak var nameLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="AddImgCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="148.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="148.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jjj-1k-5UP">
<rect key="frame" x="15" y="147.5" width="360" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="eDf-MR-72g"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="标题" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XSw-NZ-AO1">
<rect key="frame" x="15" y="15" width="360" height="18.5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="18.5" id="Nrc-i5-Oqy"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y24-ev-r8H">
<rect key="frame" x="0.0" y="43.5" width="375" height="105"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gQv-oK-QZk">
<rect key="frame" x="0.0" y="0.0" width="375" height="105"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="width" constant="375" id="2Qg-D9-vf1">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstAttribute="height" constant="105" id="es6-VA-jmP">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="gQv-oK-QZk" firstAttribute="leading" secondItem="9px-ex-b2X" secondAttribute="leading" id="Glf-7Z-Btv"/>
<constraint firstAttribute="trailing" secondItem="gQv-oK-QZk" secondAttribute="trailing" id="OO0-fE-rTK"/>
<constraint firstAttribute="bottom" secondItem="gQv-oK-QZk" secondAttribute="bottom" id="ZX2-hb-scm"/>
<constraint firstItem="gQv-oK-QZk" firstAttribute="top" secondItem="9px-ex-b2X" secondAttribute="top" id="wU0-jt-kxT"/>
</constraints>
<viewLayoutGuide key="contentLayoutGuide" id="uu1-Zh-eab"/>
<viewLayoutGuide key="frameLayoutGuide" id="9px-ex-b2X"/>
</scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OQa-ir-x7J">
<rect key="frame" x="15" y="43.5" width="90" height="90"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="Sbh-ll-iOW">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstAttribute="height" constant="90" id="gLW-Bq-4tz">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
<state key="normal" image="shangchuantupian"/>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Y24-ev-r8H" secondAttribute="bottom" id="B7H-xl-IXT"/>
<constraint firstAttribute="trailing" secondItem="XSw-NZ-AO1" secondAttribute="trailing" id="CEx-Ex-e8f"/>
<constraint firstItem="XSw-NZ-AO1" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="CIz-Fz-X4r"/>
<constraint firstItem="Jjj-1k-5UP" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="Jp4-6W-tib"/>
<constraint firstAttribute="bottom" secondItem="Jjj-1k-5UP" secondAttribute="bottom" id="K6E-dS-AYa"/>
<constraint firstItem="OQa-ir-x7J" firstAttribute="top" secondItem="XSw-NZ-AO1" secondAttribute="bottom" constant="10" id="PWe-fE-lIM"/>
<constraint firstItem="Y24-ev-r8H" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Qyk-fF-Qvr"/>
<constraint firstAttribute="trailing" secondItem="Y24-ev-r8H" secondAttribute="trailing" id="f0G-8q-9MZ"/>
<constraint firstItem="Y24-ev-r8H" firstAttribute="top" secondItem="XSw-NZ-AO1" secondAttribute="bottom" constant="10" id="hQe-Og-RHo"/>
<constraint firstItem="XSw-NZ-AO1" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="jPZ-Xx-Tht"/>
<constraint firstItem="OQa-ir-x7J" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="uil-xE-CIr"/>
<constraint firstAttribute="trailing" secondItem="Jjj-1k-5UP" secondAttribute="trailing" id="vn7-WL-hNG"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="addBtn" destination="OQa-ir-x7J" id="Rvb-ce-lIf"/>
<outlet property="nameLbl" destination="XSw-NZ-AO1" id="Xsv-Ua-LM8"/>
<outlet property="scrollView" destination="Y24-ev-r8H" id="zN3-QJ-59D"/>
</connections>
<point key="canvasLocation" x="131.15942028985509" y="121.54017857142857"/>
</tableViewCell>
</objects>
<resources>
<image name="shangchuantupian" width="90" height="90"/>
<namedColor name="标题字颜色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -137,7 +137,7 @@
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
//
// CommendCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
@objc protocol CommendCellDelegate {
@objc optional func CommendCellSendStr(content:String)
@objc optional func CommendCellSendH(height:CGFloat)
}
class CommendCell: UITableViewCell,AutoTextFieldDelegate{
var delegate:CommendCellDelegate?
@IBOutlet weak var line: UIView!
@IBOutlet weak var placeLbl: UILabel!
@IBOutlet weak var titleLbl: UILabel!
var autoTf:AutoTextField?
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction))
placeLbl.isUserInteractionEnabled = true
placeLbl.addGestureRecognizer(tap)
// Initialization code
}
@objc func tapAction(){
if autoTf == nil {
let textV = AutoTextField(frame: CGRect(x: titleLbl.frame.maxX+15, y: 13, width: fullScreenWidth-30-titleLbl.frame.maxX, height: 18.5), placeholder: "")
textV.backgroundColor = UIColor.clear
textV.tfDelegate = self
textV.textColor = UIColor.black
textV.textAlignment = .right
self.contentView.addSubview(textV)
autoTf = textV
}
}
func sendString(str: String) {
if str.count > 0 {
placeLbl.isHidden = true
}else{
placeLbl.isHidden = false
}
delegate?.CommendCellSendStr?(content: str)
}
func sendHeight(height: CGFloat) {
autoTf?.frame = CGRect(x: titleLbl.frame.maxX+15, y: 13, width: fullScreenWidth-30-titleLbl.frame.maxX, height: height)
titleLbl.snp.updateConstraints { (make) in
make.top.equalTo(autoTf!.snp_top)
make.left.equalTo(15)
make.right.equalTo(autoTf!.snp_left).offset(-15)
make.height.equalTo(18.5)
}
delegate?.CommendCellSendH?(height: height)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AutoTextField" customModule="GeliBusinessPlatform" customModuleProvider="target"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="47" id="KGk-i7-Jjw" customClass="CommendCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="398" height="47"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="398" height="47"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品文案" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mid-SG-EgI">
<rect key="frame" x="15" y="15" width="54" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="Iy4-9W-r0M"/>
<constraint firstAttribute="width" constant="54" id="L3p-RO-k6S"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请输入商品文案" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S58-2t-uxP">
<rect key="frame" x="84" y="15" width="299" height="18.5"/>
<constraints>
<constraint firstAttribute="height" constant="18.5" id="a6L-cc-t4K"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="灰色字体颜色"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="W34-St-iXm">
<rect key="frame" x="15" y="46" width="383" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="NOp-ze-TNS"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="S58-2t-uxP" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="8IR-MS-yh2"/>
<constraint firstItem="Mid-SG-EgI" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="Dpk-qZ-nAj"/>
<constraint firstAttribute="trailing" secondItem="W34-St-iXm" secondAttribute="trailing" id="G7X-xt-Dt3"/>
<constraint firstItem="S58-2t-uxP" firstAttribute="leading" secondItem="Mid-SG-EgI" secondAttribute="trailing" constant="15" id="S9y-Hy-358"/>
<constraint firstItem="W34-St-iXm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="ZsV-6P-jss"/>
<constraint firstItem="Mid-SG-EgI" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="jKX-cQ-WnO"/>
<constraint firstAttribute="bottom" secondItem="W34-St-iXm" secondAttribute="bottom" id="lvw-eS-fBm"/>
<constraint firstAttribute="trailing" secondItem="S58-2t-uxP" secondAttribute="trailing" constant="15" id="pJe-Zt-UoR"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="placeLbl" destination="S58-2t-uxP" id="vAI-GJ-LWk"/>
<outlet property="titleLbl" destination="Mid-SG-EgI" id="fkz-F3-jJH"/>
</connections>
<point key="canvasLocation" x="153.62318840579712" y="67.299107142857139"/>
</tableViewCell>
</objects>
<resources>
<namedColor name="标题字颜色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -121,8 +121,16 @@
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R3b-6k-iUu">
<rect key="frame" x="151" y="168.5" width="82" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="82" id="qwi-Kw-TXJ"/>
<constraint firstAttribute="height" constant="30" id="tJI-zH-vye"/>
<constraint firstAttribute="width" constant="82" id="qwi-Kw-TXJ">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstAttribute="height" constant="30" id="tJI-zH-vye">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="取消订单">
......@@ -147,8 +155,16 @@
<rect key="frame" x="248" y="168.5" width="82" height="30"/>
<color key="backgroundColor" name="按钮背景颜色"/>
<constraints>
<constraint firstAttribute="width" constant="82" id="4qc-z9-vHW"/>
<constraint firstAttribute="height" constant="30" id="WGr-SL-sTg"/>
<constraint firstAttribute="width" constant="82" id="4qc-z9-vHW">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstAttribute="height" constant="30" id="WGr-SL-sTg">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="确认订单">
......@@ -205,10 +221,22 @@
</view>
</subviews>
<constraints>
<constraint firstItem="ufT-fd-pM6" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="EKE-6C-DJq"/>
<constraint firstItem="ufT-fd-pM6" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="G5a-lj-WNr"/>
<constraint firstItem="ufT-fd-pM6" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="EKE-6C-DJq">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstItem="ufT-fd-pM6" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="G5a-lj-WNr">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstAttribute="bottom" secondItem="ufT-fd-pM6" secondAttribute="bottom" id="cex-Sc-iGM"/>
<constraint firstAttribute="trailing" secondItem="ufT-fd-pM6" secondAttribute="trailing" constant="15" id="x9W-uE-hQW"/>
<constraint firstAttribute="trailing" secondItem="ufT-fd-pM6" secondAttribute="trailing" constant="15" id="x9W-uE-hQW">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" name="app底色"/>
......@@ -248,7 +276,7 @@
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
......
//
// ShangPinGguiGeCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class ShangPinGguiGeCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
This diff is collapsed.
......@@ -92,7 +92,7 @@
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
//
// TitleAndSelectCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/22.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
@objc protocol TitleAndSelectCellDelegate {
@objc optional func TitleAndSelectCellClick(content:UIButton,cell:TitleAndSelectCell)
}
class TitleAndSelectCell: UITableViewCell {
var delegate:TitleAndSelectCellDelegate?
@IBOutlet weak var selectBtn: UIButton!
@IBAction func selectClick(_ sender: UIButton) {
delegate?.TitleAndSelectCellClick?(content: sender, cell: self)
}
@IBOutlet weak var titleLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TitleAndSelectCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="标题" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Hx-2L-jWw">
<rect key="frame" x="15" y="0.0" width="305" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nmk-ai-I5m">
<rect key="frame" x="285" y="0.0" width="20" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="dUL-xt-Cqa"/>
</constraints>
<state key="normal" title="Button" image="daixuan"/>
<state key="selected" image="yuxuan"/>
<connections>
<action selector="selectClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="s1q-8q-wPh"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="4Hx-2L-jWw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="GnK-Zb-hVm">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
<constraint firstItem="nmk-ai-I5m" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="Qle-nk-kP9"/>
<constraint firstAttribute="trailing" secondItem="4Hx-2L-jWw" secondAttribute="trailing" id="ZYQ-eh-y1K"/>
<constraint firstAttribute="bottom" secondItem="4Hx-2L-jWw" secondAttribute="bottom" id="hYK-3c-bmk"/>
<constraint firstItem="4Hx-2L-jWw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="vAt-h5-RDj"/>
<constraint firstAttribute="bottom" secondItem="nmk-ai-I5m" secondAttribute="bottom" id="y5f-9e-nDa"/>
<constraint firstAttribute="trailing" secondItem="nmk-ai-I5m" secondAttribute="trailing" constant="15" id="yv9-E1-zCT">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="selectBtn" destination="nmk-ai-I5m" id="Ds3-GX-gVv"/>
<outlet property="titleLbl" destination="4Hx-2L-jWw" id="1dE-sY-xMj"/>
</connections>
<point key="canvasLocation" x="132" y="122"/>
</tableViewCell>
</objects>
<resources>
<image name="daixuan" width="19" height="19"/>
<image name="yuxuan" width="19" height="19"/>
<namedColor name="标题字颜色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
......@@ -54,7 +54,8 @@
</connections>
</button>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="GUA-N4-Rgf">
<rect key="frame" x="259" y="6.5" width="49" height="31"/>
<rect key="frame" x="258" y="6.5" width="49" height="31"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="47" id="8ML-UL-R2l"/>
<constraint firstAttribute="height" constant="31" id="m01-R5-2E5"/>
......@@ -80,7 +81,7 @@
<constraint firstItem="zsG-fB-Zeb" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="kT5-VR-Vqg"/>
<constraint firstItem="GUA-N4-Rgf" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="n0g-sO-UI3"/>
<constraint firstAttribute="trailing" secondItem="uEc-pe-iBV" secondAttribute="trailing" id="riL-Qy-yIc"/>
<constraint firstAttribute="trailing" secondItem="GUA-N4-Rgf" secondAttribute="trailing" constant="14" id="zP6-ZR-myY"/>
<constraint firstAttribute="trailing" secondItem="GUA-N4-Rgf" secondAttribute="trailing" constant="15" id="zP6-ZR-myY"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
//
// ProductDetailViewController.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
import LGButton
class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate {
let titleArr = ["商品信息","商品图片","商品规格","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
@IBAction func submitAction(_ sender: Any) {
}
@IBOutlet weak var submitBtn: LGButton!
@IBOutlet weak var listTbv: UITableView!
var cellHeight = 18.5
var contentStr:String = ""
var guiGeArr:Array<Any> = []//根据规格资料数量控制右上角新增按钮是否显示
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "商品详情"
self.view.addSubview(navbar)
listTbv.separatorStyle = .none
listTbv.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
make.bottom.equalTo(submitBtn.snp_top)
}
listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF")
listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch")
listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn")
listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg")
listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe")
listTbv.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "Commend")
// Do any additional setup after loading the view.
}
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
return 5
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0: return 7
case 1:return 2
case 2:return 1
case 3:return 5
default:return 2
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch indexPath.section {
case 0:
if indexPath.row == 0 || indexPath.row == 4 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = spxxArr[indexPath.row]
return cell
}
if indexPath.row > 4{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.namelbl.text = spxxArr[indexPath.row]
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row]
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell
cell.nameLbl.text = sptpArr[indexPath.row]
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
return cell
case 3:
if indexPath.row < 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = qtxxArr[indexPath.row]
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = qtxxArr[indexPath.row]
return cell
}
default:
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "Commend") as! CommendCell
cell.delegate = self
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
return cell
}
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0: return 49*glscale
case 1:return 148.5*glscale
case 2:return 123.5*glscale
case 3:return 49*glscale
default:
if indexPath.row == 0 {
return CGFloat(cellHeight)+27.5
}else{
return 155.5
}
}
}
//header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39*glscale))
let lbl = UILabel(frame: CGRect(x: 15*glscale, y: 15*glscale, width: fullScreenWidth, height: 21*glscale))
lbl.text = titleArr[section]
lbl.textColor = UIColor(named: "标题字颜色")
lbl.font = UIFont.boldSystemFont(ofSize: 15)
view.addSubview(lbl)
if section == 2 && guiGeArr.count > 0{
let btn = UIButton()
btn.setTitle(" 新增", for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
btn.setImage(UIImage(named: "编组"), for: .normal)
view.addSubview(btn)
btn.sizeToFit()
btn.snp.makeConstraints { (make) in
make.centerY.equalTo(lbl.snp_centerY)
make.right.equalTo(-15)
make.height.equalTo(btn.frame.size.height)
make.width.equalTo(btn.frame.size.width)
}
let btn2 = UIButton()
btn2.backgroundColor = UIColor.black
view.addSubview(btn2)
btn2.snp.makeConstraints { (make) in
make.top.right.bottom.equalTo(0)
make.width.equalTo(80)
}
}
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 39*glscale
}
//footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10*glscale))
view.backgroundColor = UIColor(named: "app底色")
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 10*glscale
}
//MARK: - 自定义delegate
func CommendCellSendH(height: CGFloat) {
cellHeight = Double(height)
listTbv.beginUpdates()
listTbv.endUpdates()
}
func CommendCellSendStr(content: String) {
}
override func backAction() {
self.navigationController?.popViewController(animated: true)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ProductDetailViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="listTbv" destination="IHM-ED-ttx" id="Huh-Oq-0XN"/>
<outlet property="submitBtn" destination="6Jp-Xx-Q5Z" id="C6U-uz-2vx"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Jp-Xx-Q5Z" customClass="LGButton" customModule="LGButton">
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="WPf-78-zz1">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isAdaptateScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</constraint>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
<color key="value" name="按钮渐变色上"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
<color key="value" name="按钮渐变色下,字体颜色"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="gradientHorizontal" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="titleString" value="保存"/>
<userDefinedRuntimeAttribute type="number" keyPath="titleFontSize">
<real key="value" value="17"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="submitAction:" destination="-1" eventType="touchUpInside" id="Miy-vj-Bgk"/>
</connections>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="IHM-ED-ttx">
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="40h-ag-zwa"/>
<outlet property="delegate" destination="-1" id="OaC-hl-du0"/>
</connections>
</tableView>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ewl-Lo-wtw" customClass="LGButton" customModule="LGButton">
<rect key="frame" x="0.0" y="862" width="414" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="5pr-3g-1WD"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
<color key="value" name="按钮渐变色上"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
<color key="value" name="按钮渐变色下,字体颜色"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="gradientHorizontal" value="YES"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="IHM-ED-ttx" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="MNm-jA-Ppd"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="IHM-ED-ttx" secondAttribute="trailing" id="Vnl-z5-Y1J"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="6Jp-Xx-Q5Z" secondAttribute="bottom" id="eJm-P9-WlY"/>
<constraint firstItem="IHM-ED-ttx" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="iph-5V-7eS"/>
<constraint firstItem="6Jp-Xx-Q5Z" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="jJ0-JV-Yjh"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="6Jp-Xx-Q5Z" secondAttribute="trailing" id="n1j-qx-pdg"/>
<constraint firstAttribute="trailing" secondItem="ewl-Lo-wtw" secondAttribute="trailing" id="nAq-Ah-M4q"/>
<constraint firstItem="6Jp-Xx-Q5Z" firstAttribute="top" secondItem="IHM-ED-ttx" secondAttribute="bottom" id="puU-q8-Nrg"/>
<constraint firstItem="ewl-Lo-wtw" firstAttribute="top" secondItem="6Jp-Xx-Q5Z" secondAttribute="bottom" id="qSh-pw-OQl"/>
<constraint firstItem="ewl-Lo-wtw" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="zse-fm-lO5"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="147.82608695652175" y="82.366071428571431"/>
</view>
</objects>
<resources>
<namedColor name="按钮渐变色上">
<color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="按钮渐变色下,字体颜色">
<color red="0.27450980392156865" green="0.5607843137254902" blue="0.88627450980392153" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -9,7 +9,7 @@
import UIKit
import LGButton
class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFCellDelegate,TitleAndBtnCellDelegate,TitleAndSwitchCellDelegate,TitleAndSwitchHeaderViewDelegate,NewCreateHeaderDelegate,NewCreateFooterDelegate,YuShouCellDelegate{
class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFCellDelegate,TitleAndBtnCellDelegate,TitleAndSwitchCellDelegate,TitleAndSwitchHeaderViewDelegate,NewCreateHeaderDelegate,NewCreateFooterDelegate,YuShouCellDelegate,GLAlertSelectViewDelegate{
let titleArray = ["售价:","规格:","重量:","温藏:","单位:"]
let pliceHolderArr = ["请输入商品售价","请输入商品规格","请输入商品重量","请选择商品温藏","请选择商品单位"]
......@@ -25,6 +25,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
//规格
var normalArr:NSArray = []//普通
var specalArr:NSArray = []//预售
//选择页面
var selectView:GLAlertSelectView? = nil
var selectListArr:Array<String> = ["a","b","c"]
//测试数据
var addNormal = 0
var addSpecal = 0
......@@ -47,6 +51,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
listTbv?.register(UINib(nibName: "YuShouCell", bundle: nil), forCellReuseIdentifier: "YuShou")
listTbv?.register(UINib(nibName: "PuTongJieTiCell", bundle: nil), forCellReuseIdentifier: "PuTongJieTi")
listTbv?.register(UINib(nibName: "DelGuiGeCell", bundle: nil), forCellReuseIdentifier: "DelGuiGe")
}
......@@ -57,6 +62,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
if (navbar.title?.contains("编辑"))! {
return 4
}else{
......@@ -64,6 +70,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return titleArray.count
}
......@@ -86,6 +93,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
if indexPath.row < 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
......@@ -215,7 +223,40 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func textFieldContent(content: String, cell: TitleAndTFCell) {
}
func GLAlertSelectViewClose(sender: UIButton) {
print("关闭")
selectView?.removeFromSuperview()
selectView = nil
}
func GLAlertSelectViewClick(sender: UIButton, cell: TitleAndSelectCell) {
print(cell.tag)
}
func GLAlertSelectSubmitAction() {
print("确定")
selectView?.removeFromSuperview()
selectView = nil
}
func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.tag == 3 {
if selectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.titleLbl.text = "请选择商品温藏"
view.delegate = self
view.dataArr = selectListArr
self.view.addSubview(view)
selectView = view
}
}else{
if selectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.titleLbl.text = "请选择商品单位"
view.delegate = self
view.dataArr = selectListArr
self.view.addSubview(view)
selectView = view
}
}
}
func switchStatus(sender: UISwitch) {
......@@ -262,4 +303,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
listTbv.reloadData()
}
//MARK: - 选择页面
}
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