1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // PushNotificationSettingsViewController.swift
- // RainbowPlanet
- //
- // Created by 南鑫林 on 2019/9/19.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- //
- import UIKit
- class PushNotificationSettingsViewController: BaseViewController {
-
- let sections = [["接收推送通知"],
- ["系统通知","评论和回复","赞与互动","关注"]]
-
- override func viewDidLoad() {
- super.viewDidLoad()
- setupViews()
- setupLayouts()
- // Do any additional setup after loading the view.
- }
-
- override func setupViews() {
- navigationBar.title = "推送通知设置"
- view.addSubview(tableView)
- }
-
- override func setupLayouts() {
- tableView.snp.makeConstraints { (make) in
- make.right.left.bottom.equalToSuperview()
- make.top.equalTo(kNavBarTotalHeight)
- }
- }
-
- private lazy var tableView: UITableView = {
- let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
- tableView.backgroundColor = kf7f8faColor
- tableView.delegate = self
- tableView.dataSource = self
- tableView.rowHeight = 48
- tableView.separatorStyle = .none
- return tableView
- }()
- }
- extension PushNotificationSettingsViewController : UITableViewDelegate,UITableViewDataSource {
-
- func numberOfSections(in tableView: UITableView) -> Int {
- return sections.count
- }
-
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return sections[section].count
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = PushNotificationSettingsTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
- cell.title = sections[indexPath.section][indexPath.row]
- return cell
- }
-
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- }
-
-
- func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- switch section {
- case 1:
- let headerView = PushNotificationSettingsOneSectionHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 40))
- return headerView
- default:
- return nil
- }
- }
-
-
- func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
- switch section {
- case 0:
- return 10
- default:
- return 40
- }
- }
-
- func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
- return nil
- }
-
- func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- return 0.0000001
- }
-
- }
|