123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // PublishAddressPOICell.swift
- // RainbowPlanet
- //
- // Created by Christopher on 2019/6/19.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- //
- import UIKit
- import RxSwift
- import RxCocoa
- class PublishAddressPOICell: UITableViewCell {
-
- let disposeBag = DisposeBag()
-
- class func cellWith(tableView:UITableView,indexPath:IndexPath) -> PublishAddressPOICell {
- let ID = "PublishAddressPOICell"
- tableView.register(PublishAddressPOICell.self, forCellReuseIdentifier: ID)
- let cell : PublishAddressPOICell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! PublishAddressPOICell
- 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")
- }
-
- //MARK: - indexPath
- var indexPath: IndexPath?{
- didSet {
-
- }
- }
-
- var suggestionInfo: BMKSuggestionInfo? {
- didSet {
- switch indexPath?.section {
- case 1:
- titleLabel.text = self.suggestionInfo!.district + self.suggestionInfo!.key
- default:
- break
- }
- }
- }
-
- var poiInfo: SwiftLocationPOIModel? {
- didSet {
- switch indexPath?.section {
- case 1:
- titleLabel.text = self.poiInfo?.name
- default:
- break
- }
- }
- }
-
- var locationAddress: String? {
- didSet {
-
- if locationAddress != "" && locationAddress != nil {
- titleLabel.text = locationAddress
- }else {
- titleLabel.text = LocationModel.shared().getLocationModel()?.city ?? "西安市"
- }
- }
- }
-
- //MARK: - 设置view
- private func setupViews() {
- self.selectionStyle = .none
- addSubview(titleLabel)
- addSubview(bottomLineLabel)
- }
-
- private func setupLayouts() {
- titleLabel.snp.makeConstraints { (make) in
- make.centerY.equalToSuperview()
- make.left.equalTo(14)
- make.right.equalTo(-14)
- make.height.equalTo(21)
- }
-
- bottomLineLabel.snp.makeConstraints { (make) in
- make.bottom.equalToSuperview()
- make.left.equalTo(titleLabel.snp_left)
- make.right.equalTo(titleLabel.snp_right)
- make.height.equalTo(0.5)
- }
-
- }
-
- private lazy var titleLabel: UILabel = {
- let titleLabel = UILabel()
- titleLabel.textColor = k333333Color
- titleLabel.font = kMediumFont15
- titleLabel.textAlignment = .left
- titleLabel.numberOfLines = 0
- return titleLabel
- }()
-
- private lazy var bottomLineLabel: UILabel = {
- let bottomLineLabel = UILabel()
- bottomLineLabel.backgroundColor = kf5f5f5Color
- return bottomLineLabel
- }()
- }
|