mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add Account scenes should have account graphic in header. Issue #1305
This commit is contained in:
@@ -39,8 +39,24 @@ class FeedbinAccountViewController: UITableViewController {
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: emailTextField)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: passwordTextField)
|
||||
|
||||
tableView.register(ImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
return section == 0 ? 64.0 : super.tableView(tableView, heightForHeaderInSection: section)
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||
if section == 0 {
|
||||
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
|
||||
headerView.imageView.image = AppAssets.image(for: .feedbin)
|
||||
return headerView
|
||||
} else {
|
||||
return super.tableView(tableView, viewForHeaderInSection: section)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func cancel(_ sender: Any) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
delegate?.dismiss()
|
||||
|
||||
@@ -19,6 +19,8 @@ class LocalAccountViewController: UITableViewController {
|
||||
super.viewDidLoad()
|
||||
navigationItem.title = Account.defaultLocalAccountName
|
||||
nameTextField.delegate = self
|
||||
|
||||
tableView.register(ImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
|
||||
}
|
||||
|
||||
@IBAction func cancel(_ sender: Any) {
|
||||
@@ -33,6 +35,20 @@ class LocalAccountViewController: UITableViewController {
|
||||
delegate?.dismiss()
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
return section == 0 ? 64.0 : super.tableView(tableView, heightForHeaderInSection: section)
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||
if section == 0 {
|
||||
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
|
||||
headerView.imageView.image = AppAssets.image(for: .onMyMac)
|
||||
return headerView
|
||||
} else {
|
||||
return super.tableView(tableView, viewForHeaderInSection: section)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension LocalAccountViewController: UITextFieldDelegate {
|
||||
|
||||
@@ -36,7 +36,7 @@ class AccountInspectorViewController: UITableViewController {
|
||||
navigationItem.leftBarButtonItem = doneBarButtonItem
|
||||
}
|
||||
|
||||
tableView.register(InspectorImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
|
||||
tableView.register(ImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ extension AccountInspectorViewController {
|
||||
guard let account = account else { return nil }
|
||||
|
||||
if section == 0 {
|
||||
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! InspectorImageHeaderView
|
||||
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView
|
||||
headerView.imageView.image = AppAssets.image(for: account.type)
|
||||
return headerView
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// InspectorHeaderView.swift
|
||||
// ImageHeaderView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 11/3/19.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class InspectorImageHeaderView: UITableViewHeaderFooterView {
|
||||
class ImageHeaderView: UITableViewHeaderFooterView {
|
||||
|
||||
var imageView = UIImageView()
|
||||
|
||||
Reference in New Issue
Block a user