show password categories

This commit is contained in:
Bob Sun 2017-02-06 21:53:54 +08:00
parent ceba7d271b
commit 59eb4af8bb
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
6 changed files with 44 additions and 12 deletions

View file

@ -10,6 +10,8 @@ import UIKit
class PasswordDetailTableViewController: UITableViewController, UIGestureRecognizerDelegate {
var passwordEntity: PasswordEntity?
var passwordCategoryEntities: [PasswordCategoryEntity]?
var passwordCategoryText = ""
var password = Password()
struct TableCell {
@ -29,6 +31,11 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
tableView.register(UINib(nibName: "LabelTableViewCell", bundle: nil), forCellReuseIdentifier: "labelCell")
tableView.register(UINib(nibName: "PasswordDetailTitleTableViewCell", bundle: nil), forCellReuseIdentifier: "passwordDetailTitleTableViewCell")
let passwordCategoryArray = passwordCategoryEntities?.map({ (value: PasswordCategoryEntity) -> String in
value.category!
})
passwordCategoryText = (passwordCategoryArray?.joined(separator: " > "))!
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(PasswordDetailTableViewController.tapMenu(recognizer:)))
tableView.addGestureRecognizer(tapGesture)
tapGesture.delegate = self
@ -119,7 +126,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordDetailTitleTableViewCell", for: indexPath) as! PasswordDetailTitleTableViewCell
cell.passwordImageImageView.image = #imageLiteral(resourceName: "PasswordImagePlaceHolder")
cell.nameLabel.text = passwordEntity?.name
cell.categoryLabel.text = "category1 > category2"
cell.categoryLabel.text = passwordCategoryText
return cell
} else {