Add Account scenes should have account graphic in header. Issue #1305

This commit is contained in:
Maurice Parker
2019-11-16 15:47:12 -06:00
parent 901ac3b6aa
commit e74e6cb875
5 changed files with 41 additions and 9 deletions

View File

@@ -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()

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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()