Commit 9ee1f4ce authored by 刘俊宏's avatar 刘俊宏

完成城市列表UI

parent 1d31b7d6
...@@ -374,6 +374,9 @@ ...@@ -374,6 +374,9 @@
F9023F722449ACA800DD5A63 /* TitleAndSwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */; }; F9023F722449ACA800DD5A63 /* TitleAndSwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */; };
F905A7D5246CF57700E3A74D /* Parchment in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D4246CF57700E3A74D /* Parchment */; }; F905A7D5246CF57700E3A74D /* Parchment in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D4246CF57700E3A74D /* Parchment */; };
F905A7D8246CF82400E3A74D /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D7246CF82400E3A74D /* SwipeCellKit */; }; F905A7D8246CF82400E3A74D /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D7246CF82400E3A74D /* SwipeCellKit */; };
F90F881E24C8233D0050EF02 /* CityListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F90F881C24C8233D0050EF02 /* CityListViewController.swift */; };
F90F881F24C8233D0050EF02 /* CityListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F90F881D24C8233D0050EF02 /* CityListViewController.xib */; };
F90F882324C841280050EF02 /* UITableViewIndexView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F90F882224C841280050EF02 /* UITableViewIndexView.swift */; };
F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; }; F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; };
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; }; F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; };
F9217E012485E6E800C4CF67 /* MessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9217E002485E6E800C4CF67 /* MessageListModel.swift */; }; F9217E012485E6E800C4CF67 /* MessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9217E002485E6E800C4CF67 /* MessageListModel.swift */; };
...@@ -961,6 +964,9 @@ ...@@ -961,6 +964,9 @@
F9023F6C2449A9B100DD5A63 /* TitleAndTFCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndTFCell.xib; sourceTree = "<group>"; }; F9023F6C2449A9B100DD5A63 /* TitleAndTFCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndTFCell.xib; sourceTree = "<group>"; };
F9023F6F2449ACA800DD5A63 /* TitleAndSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndSwitchCell.swift; sourceTree = "<group>"; }; F9023F6F2449ACA800DD5A63 /* TitleAndSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndSwitchCell.swift; sourceTree = "<group>"; };
F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchCell.xib; sourceTree = "<group>"; }; F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchCell.xib; sourceTree = "<group>"; };
F90F881C24C8233D0050EF02 /* CityListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityListViewController.swift; sourceTree = "<group>"; };
F90F881D24C8233D0050EF02 /* CityListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CityListViewController.xib; sourceTree = "<group>"; };
F90F882224C841280050EF02 /* UITableViewIndexView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewIndexView.swift; sourceTree = "<group>"; };
F9171EFB245128B200359C2B /* Interface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interface.swift; sourceTree = "<group>"; }; F9171EFB245128B200359C2B /* Interface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interface.swift; sourceTree = "<group>"; };
F9171F0124513C5B00359C2B /* UpDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpDataModel.swift; sourceTree = "<group>"; }; F9171F0124513C5B00359C2B /* UpDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpDataModel.swift; sourceTree = "<group>"; };
F9217E002485E6E800C4CF67 /* MessageListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListModel.swift; sourceTree = "<group>"; }; F9217E002485E6E800C4CF67 /* MessageListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListModel.swift; sourceTree = "<group>"; };
...@@ -1835,6 +1841,7 @@ ...@@ -1835,6 +1841,7 @@
E09B03AD2445B0BA00211A51 /* ViewController */ = { E09B03AD2445B0BA00211A51 /* ViewController */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
F90F881B24C822750050EF02 /* 城市列表(货拉拉) */,
F9956B1F24640865001A617D /* 商品分类 */, F9956B1F24640865001A617D /* 商品分类 */,
E0A409C5246400BA00CFF109 /* 分类Cell */, E0A409C5246400BA00CFF109 /* 分类Cell */,
E0A409C02463F2F400CFF109 /* 收支统计 */, E0A409C02463F2F400CFF109 /* 收支统计 */,
...@@ -2351,6 +2358,16 @@ ...@@ -2351,6 +2358,16 @@
path = Cell; path = Cell;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
F90F881B24C822750050EF02 /* 城市列表(货拉拉) */ = {
isa = PBXGroup;
children = (
F90F881C24C8233D0050EF02 /* CityListViewController.swift */,
F90F881D24C8233D0050EF02 /* CityListViewController.xib */,
F90F882224C841280050EF02 /* UITableViewIndexView.swift */,
);
path = "城市列表(货拉拉)";
sourceTree = "<group>";
};
F924B38E24971BB600A913CD /* CustomerModel */ = { F924B38E24971BB600A913CD /* CustomerModel */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -3110,6 +3127,7 @@ ...@@ -3110,6 +3127,7 @@
E042F74124528CD500CDFA12 /* TitleAndOnlyBtnCell.xib in Resources */, E042F74124528CD500CDFA12 /* TitleAndOnlyBtnCell.xib in Resources */,
E0D46C5724503EC50087B564 /* TitleAndSelectCell.xib in Resources */, E0D46C5724503EC50087B564 /* TitleAndSelectCell.xib in Resources */,
E00ACBEC2490D6C800128052 /* YDLBVc.xib in Resources */, E00ACBEC2490D6C800128052 /* YDLBVc.xib in Resources */,
F90F881F24C8233D0050EF02 /* CityListViewController.xib in Resources */,
E013D78D2484CAFC0092DE46 /* CRKBtnCell.xib in Resources */, E013D78D2484CAFC0092DE46 /* CRKBtnCell.xib in Resources */,
E0A2E82C24555D8600D6DB34 /* KuCunXiangQingCell.xib in Resources */, E0A2E82C24555D8600D6DB34 /* KuCunXiangQingCell.xib in Resources */,
E020632D246CDD3F007A40C4 /* OrderDViewFooterView.xib in Resources */, E020632D246CDD3F007A40C4 /* OrderDViewFooterView.xib in Resources */,
...@@ -3343,6 +3361,7 @@ ...@@ -3343,6 +3361,7 @@
F950FDDD24518B9500C40530 /* FSCalendarCollectionViewLayout.m in Sources */, F950FDDD24518B9500C40530 /* FSCalendarCollectionViewLayout.m in Sources */,
E07B1E5E24591AA50055BA3C /* KeHuXQViewController.swift in Sources */, E07B1E5E24591AA50055BA3C /* KeHuXQViewController.swift in Sources */,
F9DDBE962457D3EC00A32CB2 /* WebViewController.swift in Sources */, F9DDBE962457D3EC00A32CB2 /* WebViewController.swift in Sources */,
F90F882324C841280050EF02 /* UITableViewIndexView.swift in Sources */,
F956D5AA246A2D9C003FF510 /* LMNBulletsLine.m in Sources */, F956D5AA246A2D9C003FF510 /* LMNBulletsLine.m in Sources */,
E0E4456B24B0221500EF788E /* LogisticsInterface.swift in Sources */, E0E4456B24B0221500EF788E /* LogisticsInterface.swift in Sources */,
E06524F924581A7900CA22E2 /* ChuKuCell.swift in Sources */, E06524F924581A7900CA22E2 /* ChuKuCell.swift in Sources */,
...@@ -3488,6 +3507,7 @@ ...@@ -3488,6 +3507,7 @@
E09B03A32445AF9500211A51 /* NetworkRequest.swift in Sources */, E09B03A32445AF9500211A51 /* NetworkRequest.swift in Sources */,
E0D46C5624503EC50087B564 /* TitleAndSelectCell.swift in Sources */, E0D46C5624503EC50087B564 /* TitleAndSelectCell.swift in Sources */,
E0706EF424B40BE800D8251C /* TitleAndTfYuanCell.swift in Sources */, E0706EF424B40BE800D8251C /* TitleAndTfYuanCell.swift in Sources */,
F90F881E24C8233D0050EF02 /* CityListViewController.swift in Sources */,
F93E32112473E05C00524DFC /* GeliAlertTextView.swift in Sources */, F93E32112473E05C00524DFC /* GeliAlertTextView.swift in Sources */,
E0F97B022451228A001BD600 /* GLAlertSelectView.swift in Sources */, E0F97B022451228A001BD600 /* GLAlertSelectView.swift in Sources */,
F96E9D5C246656A700B5B94A /* HGImagePickerCell.swift in Sources */, F96E9D5C246656A700B5B94A /* HGImagePickerCell.swift in Sources */,
......
{ {
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [ "colors" : [
{ {
"idiom" : "universal",
"color" : { "color" : {
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"red" : "0.392",
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0.392", "blue" : "0x63",
"green" : "0.392" "green" : "0x63",
"red" : "0x63"
} }
},
"idiom" : "universal"
} }
],
"info" : {
"author" : "xcode",
"version" : 1
} }
]
} }
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF2",
"green" : "0xEC",
"red" : "0xE8"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
<?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="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" 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>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<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"/>
...@@ -10,7 +11,7 @@ ...@@ -10,7 +11,7 @@
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TitleContentCell" customModule="GeliBusinessPlatform" customModuleProvider="target"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TitleContentCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/> <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <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"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
......
...@@ -46,6 +46,7 @@ class SearchBarView: UISearchBar { ...@@ -46,6 +46,7 @@ class SearchBarView: UISearchBar {
let searchField: UITextField = self.value(forKey: "searchField") as! UITextField let searchField: UITextField = self.value(forKey: "searchField") as! UITextField
searchField.textColor = UIColor.init(named: "标题字颜色") searchField.textColor = UIColor.init(named: "标题字颜色")
searchField.clipsToBounds = true searchField.clipsToBounds = true
// searchField.backgroundColor = UIColor.init(named: "搜索框底色")
clearAction() clearAction()
} }
......
<?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="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="16097" 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>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<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"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GoodsClassViewController" customModule="GeliBusinessPlatform" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GoodsClassViewController" customModule="TestClass" customModuleProvider="target">
<connections> <connections>
<outlet property="sureBtn" destination="eo7-gg-VuW" id="1Uq-wf-ger"/> <outlet property="sureBtn" destination="eo7-gg-VuW" id="1Uq-wf-ger"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="蓝色字体颜色"> <namedColor name="蓝色字体颜色">
<color red="0.27799999713897705" green="0.56099998950958252" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
</resources> </resources>
</document> </document>
//
// CityListViewController.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/7/22.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class CityListViewController: BaseViewController ,UITableViewDelegate,UITableViewDataSource{
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var topView: UIView!
var adHeaders:[String] = ["A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "城市列表"
self.view.addSubview(navbar)
SetTopFrame(view: topView, height: 50)
listView.separatorStyle = .none
listView.register(UINib(nibName: "TitleContentCell", bundle: nil), forCellReuseIdentifier: "TitleContentCell")
let searchBr = SearchBarView.init()
topView.addSubview(searchBr)
searchBr.snp.makeConstraints { (make) in
make.left.equalTo(10)
make.right.equalTo(-10)
make.centerY.equalToSuperview()
make.height.equalTo(35)
}
searchBr.placeholderStr = "请输入城市名称或拼音"
searchBr.cornerRadius = 35/2.0
listView.customIndexView(indexTitles: adHeaders)
listView.indexView = CustomIndexView()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 45
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func numberOfSections(in tableView: UITableView) -> Int {
return adHeaders.count;
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleContentCell") as! TitleContentCell
cell.contentLbl.isHidden = true
let secno = indexPath.section
cell.titleLbl?.text = self.adHeaders[secno]+String(indexPath.item)
return cell
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 30
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = UIColor.init(named: "app底色")
let cityLbl = UILabel()
let headers = self.adHeaders
cityLbl.text = headers[section]
cityLbl.textColor = UIColor.init(named: "灰色字体颜色")
cityLbl.font = UIFont.systemFont(ofSize: 11)
view.addSubview(cityLbl)
cityLbl.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.top.equalTo(7)
}
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" 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"/>
<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="CityListViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="listView" destination="m37-8o-DjS" id="ZAF-AI-0qc"/>
<outlet property="topView" destination="vCi-ZI-P2x" id="M0Z-eu-pbV"/>
<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="vCi-ZI-P2x">
<rect key="frame" x="0.0" y="44" width="414" height="50"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="oET-rs-Vr4"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="m37-8o-DjS">
<rect key="frame" x="0.0" y="169" width="414" height="727"/>
<color key="backgroundColor" name="app底色"/>
<connections>
<outlet property="dataSource" destination="-1" id="rXg-Kn-5CZ"/>
<outlet property="delegate" destination="-1" id="hkB-Wy-Vuh"/>
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gXn-Ti-wL1">
<rect key="frame" x="0.0" y="94" width="414" height="75"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="当前城市" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BGn-Xt-fIF">
<rect key="frame" x="15" y="7" width="45" height="13.5"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="灰色字体颜色"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Abe-oY-g1U">
<rect key="frame" x="0.0" y="30" width="414" height="45"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="广州" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3pq-KF-qmk">
<rect key="frame" x="15" y="13" width="27" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="3pq-KF-qmk" firstAttribute="top" secondItem="Abe-oY-g1U" secondAttribute="top" constant="13" id="Fwx-FJ-COu"/>
<constraint firstAttribute="height" constant="45" id="aSn-ym-FV6"/>
<constraint firstItem="3pq-KF-qmk" firstAttribute="leading" secondItem="Abe-oY-g1U" secondAttribute="leading" constant="15" id="nyA-8i-7f6"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" name="app底色"/>
<constraints>
<constraint firstAttribute="height" constant="75" id="5oT-iP-Kch"/>
<constraint firstItem="Abe-oY-g1U" firstAttribute="leading" secondItem="gXn-Ti-wL1" secondAttribute="leading" id="6FV-yE-sWD"/>
<constraint firstItem="BGn-Xt-fIF" firstAttribute="top" secondItem="gXn-Ti-wL1" secondAttribute="top" constant="7" id="dPW-sz-yC2"/>
<constraint firstAttribute="bottom" secondItem="Abe-oY-g1U" secondAttribute="bottom" id="s6g-yV-tR5"/>
<constraint firstItem="BGn-Xt-fIF" firstAttribute="leading" secondItem="gXn-Ti-wL1" secondAttribute="leading" constant="15" id="uRs-sB-TCV"/>
<constraint firstAttribute="trailing" secondItem="Abe-oY-g1U" secondAttribute="trailing" id="umc-SW-vxy"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="gXn-Ti-wL1" secondAttribute="trailing" id="22A-Ci-kOI"/>
<constraint firstAttribute="bottom" secondItem="m37-8o-DjS" secondAttribute="bottom" id="A5L-gI-4wL"/>
<constraint firstItem="gXn-Ti-wL1" firstAttribute="top" secondItem="vCi-ZI-P2x" secondAttribute="bottom" id="AUU-NK-Ktm"/>
<constraint firstItem="vCi-ZI-P2x" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="Br7-0Z-GMk"/>
<constraint firstItem="m37-8o-DjS" firstAttribute="top" secondItem="gXn-Ti-wL1" secondAttribute="bottom" id="JiV-7L-tdU"/>
<constraint firstItem="m37-8o-DjS" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="L5L-hG-xGc"/>
<constraint firstItem="gXn-Ti-wL1" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="QKq-ts-Ah6"/>
<constraint firstItem="vCi-ZI-P2x" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="QdM-EM-RIH"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="vCi-ZI-P2x" secondAttribute="trailing" id="tGq-iK-Nex"/>
<constraint firstItem="m37-8o-DjS" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="xyc-RD-Cwu"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="131.8840579710145" y="138.61607142857142"/>
</view>
</objects>
<resources>
<namedColor name="app底色">
<color red="0.94509803921568625" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" 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>
//
// File.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/7/22.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
let ScreenWidth = UIScreen.main.bounds.size.width
let ScreenHeight = UIScreen.main.bounds.size.height
private var IndexViewParamKey = "IndexViewParamKey"
extension UITableView {
var indexView: CustomIndexView? {
set(view) {
objc_setAssociatedObject(self, &IndexViewParamKey, view, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
get {
return objc_getAssociatedObject(self, &IndexViewParamKey) as? CustomIndexView
}
}
func customIndexView(indexTitles: [String]) {
indexView = CustomIndexView(indexTitles: indexTitles)
self.superview?.addSubview(indexView!)
indexView?.selectedSection = { [weak self] section in
self?.scrollToRow(at: IndexPath(item: 0, section: section), at: UITableView.ScrollPosition.top, animated: false)
}
}
}
//MARK:- 自定义IndexView
class CustomIndexView: UIView {
typealias SimpleCallBackWithInt = (_ index: Int) -> ()
var selectedSection: SimpleCallBackWithInt?
private var tipLabel: UILabel!
private var indexTitles: [String] = [String]()
private var itemHeight: CGFloat = 15
private var itemWidth: CGFloat = 40
private var tipLabelWidth: CGFloat = 40
private var Tag = 11111
private let fontSize = UIFont.systemFont(ofSize: 11)
private let animationDuration: TimeInterval = 0.25
override init(frame: CGRect) {
super.init(frame: frame)
}
convenience init(frame: CGRect = CGRect.zero, indexTitles: [String]) {
self.init(frame: frame)
self.indexTitles = indexTitles
setupUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupUI() {
backgroundColor = UIColor.clear
setupLabels()
setupTipLabel()
}
func setupTipLabel() {
tipLabel = UILabel(frame: CGRect(x: -tipLabelWidth - 20, y: 0, width: tipLabelWidth, height: tipLabelWidth))
tipLabel.font = UIFont.systemFont(ofSize: 18)
tipLabel.textAlignment = .center
tipLabel.textColor = UIColor.white
tipLabel.backgroundColor = UIColor.init(named: "按钮渐变色上")
tipLabel.layer.cornerRadius = tipLabelWidth * 0.5
tipLabel.layer.masksToBounds = true
tipLabel.alpha = 0
self.addSubview(tipLabel)
}
func setupLabels() {
let itemX: CGFloat = 0
var itemY: CGFloat = 0
for i in 0..<indexTitles.count {
let label = UILabel(frame: CGRect(x: itemX, y: itemY, width: itemWidth, height: itemHeight))
label.text = indexTitles[i]
label.tag = Tag + i
label.textAlignment = .center
label.textColor = UIColor.init(named: "灰色字体颜色")
label.font = fontSize
addSubview(label)
itemY += itemHeight
if i == indexTitles.count - 1 {
self.frame.size.height = itemY
}
}
self.frame = CGRect(x: ScreenWidth - itemWidth, y: 0, width: itemWidth, height: itemY)
self.center.y = ScreenHeight * 0.6
}
func showTipsLabel(section: Int, centerY: CGFloat) {
guard let tipLabel = self.tipLabel else { return }
selectedSection?(section)
tipLabel.text = self.indexTitles[section]
tipLabel.center.y = centerY
UIView.animate(withDuration: animationDuration, animations: {
tipLabel.alpha = 1
})
}
func panAnimationWithTouches(touches: Set<UITouch>) {
guard let touch = touches.first else { return }
let point = touch.location(in: self)
for i in 0..<indexTitles.count {
if let label = self.viewWithTag(Tag + i) {
if label.frame.contains(point) {
showTipsLabel(section: i, centerY: label.center.y)
}
}
}
}
func panAnimationFinished() {
guard let tipLabel = self.tipLabel else { return }
UIView.animate(withDuration: animationDuration, animations: {
tipLabel.alpha = 0
})
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
panAnimationWithTouches(touches: touches)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
panAnimationWithTouches(touches: touches)
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
panAnimationFinished()
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
panAnimationFinished()
}
deinit {
self.tipLabel.removeFromSuperview()
self.removeFromSuperview()
self.selectedSection = nil
}
}
...@@ -58,7 +58,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -58,7 +58,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
make.left.equalTo(10) make.left.equalTo(10)
make.right.equalTo(-10) make.right.equalTo(-10)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.height.equalTo(30) make.height.equalTo(35)
} }
searchV = searchBr searchV = searchBr
searchBr.placeholderStr = "请输入运单号/收货人/发货人/地址" searchBr.placeholderStr = "请输入运单号/收货人/发货人/地址"
......
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