You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.6 KiB

//
// TableViewController.swift
// SwiftHub
//
// Created by Khoren Markosyan on 1/4/17.
// Copyright © 2017 Khoren Markosyan. All rights reserved.
//
import UIKit
import MJRefresh
class TableViewController: ViewController, UIScrollViewDelegate {
var tableViewStyle: UITableView.Style = .plain
var clearsSelectionOnViewWillAppear = true
lazy var tableView: TableView = {
let view = TableView(frame: CGRect.zero, style: tableViewStyle)
self.view.addSubview(view)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if clearsSelectionOnViewWillAppear == true {
deselectSelectedRow()
}
}
}
extension TableViewController {
func deselectSelectedRow() {
if let selectedIndexPaths = tableView.indexPathsForSelectedRows {
selectedIndexPaths.forEach({ (indexPath) in
tableView.deselectRow(at: indexPath, animated: false)
})
}
}
}
//extension TableViewController: UITableViewDelegate {
//
// func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
// if let view = view as? UITableViewHeaderFooterView {
// view.textLabel?.font = UIFont(name: ".SFUIText-Bold", size: 15.0)!
//// themeService.rx
//// .bind({ $0.text }, to: view.textLabel!.rx.textColor)
//// .bind({ $0.primaryDark }, to: view.contentView.rx.backgroundColor)
//// .disposed(by: rx.disposeBag)
// }
// }
//}