Skip to content

Commit

Permalink
Add table row cells and conform to NUXKeyboardResponder
Browse files Browse the repository at this point in the history
  • Loading branch information
mindgraffiti committed Jun 2, 2020
1 parent cf90a80 commit dfd7f4f
Showing 1 changed file with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import UIKit
final class SiteAddressViewController: LoginViewController {

@IBOutlet private weak var tableView: UITableView!
@IBOutlet var bottomContentConstraint: NSLayoutConstraint?

var displayStrings: WordPressAuthenticatorDisplayStrings {
return WordPressAuthenticator.shared.displayStrings
Expand All @@ -28,10 +29,34 @@ final class SiteAddressViewController: LoginViewController {
// MARK: - UITableViewDataSource
extension SiteAddressViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
return 4
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
return tableView.dequeueReusableCell(withIdentifier: "largetitlecell") ?? UITableViewCell()
}

if indexPath.row == 1 {
return tableView.dequeueReusableCell(withIdentifier: "emailcell") ?? UITableViewCell()
}

if indexPath.row == 2 {
return tableView.dequeueReusableCell(withIdentifier: "instructionscell") ?? UITableViewCell()
}

if indexPath.row == 3 {
return tableView.dequeueReusableCell(withIdentifier: "textfieldcell") ?? UITableViewCell()
}

if indexPath.row == 4 {
return tableView.dequeueReusableCell(withIdentifier: "errorcell") ?? UITableViewCell()
}

if indexPath.row == 5 {
return tableView.dequeueReusableCell(withIdentifier: "secondaryhelperbuttoncell") ?? UITableViewCell()
}

return UITableViewCell()
}
}
Expand All @@ -41,3 +66,20 @@ extension SiteAddressViewController: UITableViewDataSource {
extension SiteAddressViewController: UITableViewDelegate {

}

// MARK: - Keyboard Notifications
extension SiteAddressViewController: NUXKeyboardResponder {
var verticalCenterConstraint: NSLayoutConstraint? {
// no-op
return nil
}

@objc func handleKeyboardWillShow(_ notification: Foundation.Notification) {
keyboardWillShow(notification)
}


@objc func handleKeyboardWillHide(_ notification: Foundation.Notification) {
keyboardWillHide(notification)
}
}

0 comments on commit dfd7f4f

Please sign in to comment.