Update fill password UI

- Click the setting icon to show or hide the slider.
- Clicking on other sections does not work now (remove gesture)
This commit is contained in:
Yishi Lin 2017-03-30 01:17:22 +08:00
parent 820c4eca04
commit abce9d7be5
4 changed files with 50 additions and 52 deletions

View file

@ -10,6 +10,7 @@ import UIKit
protocol FillPasswordTableViewCellDelegate {
func generateAndCopyPassword()
func showHidePasswordSettings()
}
class FillPasswordTableViewCell: ContentTableViewCell {
@ -17,10 +18,17 @@ class FillPasswordTableViewCell: ContentTableViewCell {
@IBOutlet weak var contentTextField: UITextField!
var delegate: FillPasswordTableViewCellDelegate?
@IBOutlet weak var settingButton: UIButton!
@IBOutlet weak var generateButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
contentTextField.font = UIFont(name: Globals.passwordFonts, size: (contentTextField.font?.pointSize)!)
// Force aspect ratio of button images
settingButton.imageView?.contentMode = .scaleAspectFit
generateButton.imageView?.contentMode = .scaleAspectFit
}
override func setSelected(_ selected: Bool, animated: Bool) {
@ -33,6 +41,10 @@ class FillPasswordTableViewCell: ContentTableViewCell {
self.delegate?.generateAndCopyPassword()
}
@IBAction func showHidePasswordSettings() {
self.delegate?.showHidePasswordSettings()
}
// re-color
@IBAction func textFieldDidChange(_ sender: UITextField) {
contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "")