Commit b096ad32 authored by lujunye's avatar lujunye

货拉拉界面合并

parent 17c75f24
......@@ -246,91 +246,10 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
//MARK: - CELL DELEGATE
//MARK: - 货拉拉 headerView
@objc func topBtnClick(btn:UIButton){
for item in btnArr {
if item == btn {
item.isSelected = true
item.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
topBtnLine.frame = CGRect(x: item.frame.origin.x, y: topBtnLine.frame.minY, width: item.bounds.size.width*0.65, height: 2.5)
topBtnLine.center = CGPoint(x: item.center.x, y: topBtnLine.center.y)
}else{
item.isSelected = false
item.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
}
}
}
var btnArr:Array<UIButton> = []
var topBtnLine:UIView = UIView()
func setBtnUI(carTypesArr:Array<String>,view:UIView){
btnArr.removeAll()
var num = carTypesArr.count
if num > 5 {
num = 5
for i in 0 ..< num {
let btn = UIButton()
btn.setTitle(carTypesArr[i], for: .normal)
btn.tag = i
view.addSubview(btn)
btn.sizeToFit()
var x:CGFloat = 0
if btnArr.count != 0 {
let button = btnArr[i-1]
x = button.frame.maxX
}
btn.frame = CGRect(x:x, y: 0, width: btn.bounds.size.width + 6, height: 44)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
btn.addTarget(self, action: #selector(topBtnClick), for: .touchUpInside)
btnArr.append(btn)
}
let button = UIButton(frame: CGRect(x: fullScreenWidth-44, y: 0, width: 44, height: 44))
// button.setImage(UIImage(named: ""), for: .normal)
view.addSubview(button)
let line = UIView()
line.backgroundColor = UIColor(named: "灰色分界线")
view.addSubview(line)
line.snp_makeConstraints { (make) in
make.height.equalTo(30)
make.width.equalTo(1)
make.right.equalTo(button.snp_left)
make.centerY.equalTo(view.snp_centerY)
}
}else{
for i in 0 ..< num {
let btn = UIButton()
btn.setTitle(carTypesArr[i], for: .normal)
btn.tag = i
view.addSubview(btn)
btn.sizeToFit()
var x:CGFloat = 0
if btnArr.count != 0 {
let button = btnArr[i-1]
x = button.frame.maxX
}
btn.frame = CGRect(x:x, y: 0, width: btn.bounds.size.width + 6, height: 44)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
btn.addTarget(self, action: #selector(topBtnClick), for: .touchUpInside)
btnArr.append(btn)
}
}
let btn = btnArr.first
btn!.isSelected = true
btn!.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
topBtnLine.backgroundColor = UIColor(named: "蓝色字体颜色")
topBtnLine.frame = CGRect(x: 0, y: 41.5, width: (btn?.bounds.size.width)!*0.65, height: 2.5)
topBtnLine.center = CGPoint(x: (btn?.center.x)!, y: topBtnLine.center.y)
topBtnLine.layer.cornerRadius = 1.25
topBtnLine.layer.masksToBounds = true
view.addSubview(topBtnLine)
}
var carTypesArr:Array<String> = ["小面包车","中面包车","小货车","中货车","5米2","ababa"]
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 2 {
if tableView == hListView {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 5))
view.backgroundColor = UIColor(named: "app底色")
return view
......@@ -339,10 +258,12 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if tableView == hListView {//货拉拉
if section == 2 {
return 5
if section == 0{
return 0.1
}
return 0.1
return 5
}else{
return 0.1
}
......@@ -350,7 +271,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if tableView == listView {
if section == 2 {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 41.5*glscale))
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 41.5))
view.backgroundColor = UIColor(named: "app底色")
let btn = UIButton()
......@@ -436,17 +357,17 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if tableView == listView {
if section == 0 {
return 10*glscale
return 10
}
if section == 1 {
return 5*glscale
return 5
}
return 41.5*glscale
return 41.5
}else{//货拉拉
if section == 1 {
return 49
}
return 5*glscale
return 5
}
}
......@@ -671,5 +592,95 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
return cell
}
}
@objc func topBtnClick(btn:UIButton){
for item in btnArr {
if item == btn {
item.isSelected = true
item.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
topBtnLine.frame = CGRect(x: item.frame.origin.x, y: topBtnLine.frame.minY, width: item.bounds.size.width*0.65, height: 2.5)
topBtnLine.center = CGPoint(x: item.center.x, y: topBtnLine.center.y)
}else{
item.isSelected = false
item.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
}
}
}
@objc func scrollToPage(sender:UIButton){
let idx = IndexPath(row: 0, section: 0)
let cell = hListView.cellForRow(at:idx) as! HLLTopCell
cell.scrollView?.setContentOffset(CGPoint(x: sender.tag * Int(CGFloat(cell.scViewBg.bounds.size.width)), y: 0), animated: true)
cell.idx = sender.tag
}
var btnArr:Array<UIButton> = []
var topBtnLine:UIView = UIView()
func setBtnUI(carTypesArr:Array<String>,view:UIView){
btnArr.removeAll()
var num = carTypesArr.count
if num > 5 {
num = 5
for i in 0 ..< num {
let btn = UIButton()
btn.setTitle(carTypesArr[i], for: .normal)
btn.tag = i
view.addSubview(btn)
btn.sizeToFit()
var x:CGFloat = 0
if btnArr.count != 0 {
let button = btnArr[i-1]
x = button.frame.maxX
}
btn.addTarget(self, action: #selector(scrollToPage(sender:)), for: .touchUpInside)
btn.frame = CGRect(x:x, y: 0, width: btn.bounds.size.width + 6, height: 44)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
btn.addTarget(self, action: #selector(topBtnClick), for: .touchUpInside)
btnArr.append(btn)
}
let button = UIButton(frame: CGRect(x: fullScreenWidth-44, y: 0, width: 44, height: 44))
// button.setImage(UIImage(named: ""), for: .normal)
view.addSubview(button)
let line = UIView()
line.backgroundColor = UIColor(named: "灰色分界线")
view.addSubview(line)
line.snp_makeConstraints { (make) in
make.height.equalTo(30)
make.width.equalTo(1)
make.right.equalTo(button.snp_left)
make.centerY.equalTo(view.snp_centerY)
}
}else{
for i in 0 ..< num {
let btn = UIButton()
btn.setTitle(carTypesArr[i], for: .normal)
btn.tag = i
view.addSubview(btn)
btn.sizeToFit()
var x:CGFloat = 0
if btnArr.count != 0 {
let button = btnArr[i-1]
x = button.frame.maxX
}
btn.addTarget(self, action: #selector(scrollToPage(sender:)), for: .touchUpInside)
btn.frame = CGRect(x:x, y: 0, width: btn.bounds.size.width + 6, height: 44)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
btn.addTarget(self, action: #selector(topBtnClick), for: .touchUpInside)
btnArr.append(btn)
}
}
let btn = btnArr.first
btn!.isSelected = true
btn!.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
topBtnLine.backgroundColor = UIColor(named: "蓝色字体颜色")
topBtnLine.frame = CGRect(x: 0, y: 41.5, width: (btn?.bounds.size.width)!*0.65, height: 2.5)
topBtnLine.center = CGPoint(x: (btn?.center.x)!, y: topBtnLine.center.y)
topBtnLine.layer.cornerRadius = 1.25
topBtnLine.layer.masksToBounds = true
view.addSubview(topBtnLine)
}
var carTypesArr:Array<String> = ["小面包车","中面包车","小货车","中货车","5米2","ababa"]
}
......@@ -271,7 +271,7 @@
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" estimatedSectionHeaderHeight="-1" sectionFooterHeight="18" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="IhS-vZ-6YK">
<rect key="frame" x="0.0" y="44" width="414" height="714"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" name="app底色"/>
<connections>
<outlet property="dataSource" destination="-1" id="VHp-ja-2wO"/>
<outlet property="delegate" destination="-1" id="atq-MI-T7V"/>
......
......@@ -488,8 +488,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
// HUD.flash(.label("敬请期待"),delay: 1.2)
// return
// let vc = XiaYunDanViewController()
let vc = ShouZhiTongJiViewController()
let vc = XiaYunDanViewController()
// let vc = ShouZhiTongJiViewController()
self.navigationController?.pushViewController(vc, animated: true)
return
case 76: //收支详情
......
......@@ -40,7 +40,11 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
if scrollView.contentOffset.x/scViewBg.bounds.size.width <= 0 {
leftBtn.isHidden = true
}
if scrollView.contentOffset.x/scViewBg.bounds.size.width >= CGFloat(datas.count-1) {
var num = datas.count-1
if num > 4 {
num = 4
}
if scrollView.contentOffset.x/scViewBg.bounds.size.width >= CGFloat(num) {
rightBtn.isHidden = true
}
......@@ -72,9 +76,13 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
}
override func layoutIfNeeded() {
super.layoutIfNeeded()
scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(datas.count), height: (scViewBg.bounds.size.height))
var num = datas.count - 1
if num > 5 {
num = 5
}
scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(num), height: (scViewBg.bounds.size.height))
for i in 0 ..< datas.count{
for i in 0 ..< num{
let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height))
if i % 2 == 0 {
view.backgroundColor = UIColor.blue
......
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