123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // RecommendDefaultBackCell.swift
- // RainbowPlanet
- //
- // Created by Christopher on 2019/6/14.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- // 推荐图文内容--缺省Cell
- import UIKit
- import RxSwift
- class RecommendDefaultBackCell: UITableViewCell {
-
- let disposeBag = DisposeBag()
-
- typealias JumpClosure = () -> Void
- var jumpClosure : JumpClosure?
-
- class func cellWith(tableView:UITableView,indexPath:IndexPath) -> RecommendDefaultBackCell {
- let ID = "RecommendDefaultBackCell"
- tableView.register(RecommendDefaultBackCell.self, forCellReuseIdentifier: ID)
- let cell : RecommendDefaultBackCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! RecommendDefaultBackCell
- cell.indexPath = indexPath
- return cell
- }
-
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
- super.init(style: style, reuseIdentifier: reuseIdentifier)
- setupViews()
- setupLayouts()
- }
-
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- var indexPath: IndexPath? {
- didSet {
-
- }
- }
-
- //MRAK: - 设置View
- private func setupViews() {
- self.selectionStyle = .none
- backgroundColor = kffffffColor
-
- addSubview(backImageView)
- addSubview(contentLabel)
- addSubview(jumpBtn)
- }
-
- private func setupLayouts() {
- backImageView.snp.makeConstraints { (make) in
- make.top.equalTo(50)
- make.centerX.equalToSuperview()
- make.size.equalTo(120)
- }
- contentLabel.snp.makeConstraints { (make) in
- make.top.equalTo(backImageView.snp_bottom).offset(20)
- make.centerX.equalToSuperview()
- make.height.equalTo(20)
- }
- jumpBtn.snp.makeConstraints { (make) in
- make.top.equalTo(contentLabel.snp_bottom).offset(20)
- make.centerX.equalToSuperview()
- make.width.equalTo(180)
- make.height.equalTo(32)
- }
- }
-
- private lazy var backImageView : UIImageView = {
- let backImageView = UIImageView()
- backImageView.image = kImage(name: "page05")
- return backImageView
- }()
-
- private lazy var contentLabel: UILabel = {
- let contentLabel = UILabel()
- contentLabel.text = "内容飞走了,去看看别的吧"
- contentLabel.textColor = k666666Color
- contentLabel.font = kRegularFont14
- contentLabel.textAlignment = .center
- return contentLabel
- }()
-
- private lazy var jumpBtn: UIButton = {
- let jumpBtn = UIButton(type: UIButton.ButtonType.custom)
- jumpBtn.backgroundColor = k62CC74Color
- jumpBtn.setTitle("去首页", for: .normal)
- jumpBtn.setTitleColor(kffffffColor, for: .normal)
- jumpBtn.titleLabel?.font = kMediumFont16
- jumpBtn.cornerRadius = 16
- jumpBtn.masksToBounds = true
- jumpBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
- if let jumpClosure = self?.jumpClosure {
- jumpClosure()
- }
- }).disposed(by: disposeBag)
- return jumpBtn
- }()
-
- }
|