using specific cell for password generator
This commit is contained in:
parent
c0fe4711ba
commit
89cef49281
4 changed files with 100 additions and 3 deletions
|
|
@ -52,6 +52,8 @@
|
|||
DCDDEAB41E4896BF00F68193 /* PasswordDetailTitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCDDEAB21E4896BF00F68193 /* PasswordDetailTitleTableViewCell.xib */; };
|
||||
DCFB779A1E4F3BCF008DE471 /* TitleTextFieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77981E4F3BCF008DE471 /* TitleTextFieldTableViewCell.swift */; };
|
||||
DCFB779B1E4F3BCF008DE471 /* TitleTextFieldTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB77991E4F3BCF008DE471 /* TitleTextFieldTableViewCell.xib */; };
|
||||
DCFB779E1E4F40C7008DE471 /* FillPasswordTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */; };
|
||||
DCFB779F1E4F40C7008DE471 /* FillPasswordTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -105,6 +107,8 @@
|
|||
DCDDEAB21E4896BF00F68193 /* PasswordDetailTitleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PasswordDetailTitleTableViewCell.xib; path = ../PasswordDetailTitleTableViewCell.xib; sourceTree = "<group>"; };
|
||||
DCFB77981E4F3BCF008DE471 /* TitleTextFieldTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TitleTextFieldTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DCFB77991E4F3BCF008DE471 /* TitleTextFieldTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TitleTextFieldTableViewCell.xib; sourceTree = "<group>"; };
|
||||
DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FillPasswordTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FillPasswordTableViewCell.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -182,6 +186,8 @@
|
|||
DC19400F1E4B3A9E0077E0A3 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */,
|
||||
DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */,
|
||||
DCFB77981E4F3BCF008DE471 /* TitleTextFieldTableViewCell.swift */,
|
||||
DCFB77991E4F3BCF008DE471 /* TitleTextFieldTableViewCell.xib */,
|
||||
DC4914941E434301007FF592 /* LabelTableViewCell.swift */,
|
||||
|
|
@ -316,6 +322,7 @@
|
|||
DCDDEAB01E4639F300F68193 /* LabelTableViewCell.xib in Resources */,
|
||||
DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */,
|
||||
DCFB779B1E4F3BCF008DE471 /* TitleTextFieldTableViewCell.xib in Resources */,
|
||||
DCFB779F1E4F40C7008DE471 /* FillPasswordTableViewCell.xib in Resources */,
|
||||
DC037CC01E4ED4E100609409 /* TextViewTableViewCell.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -412,6 +419,7 @@
|
|||
DC037CAA1E4B8EAE00609409 /* SpecialThanksTableViewController.swift in Sources */,
|
||||
DC037CA61E4B883900609409 /* OpenSourceComponentsTableViewController.swift in Sources */,
|
||||
DC037CA81E4B898100609409 /* BasicStaticTableViewController.swift in Sources */,
|
||||
DCFB779E1E4F40C7008DE471 /* FillPasswordTableViewCell.swift in Sources */,
|
||||
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */,
|
||||
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */,
|
||||
DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ class AddPasswordTableViewController: UITableViewController {
|
|||
super.viewDidLoad()
|
||||
tableView.register(UINib(nibName: "TextFieldTableViewCell", bundle: nil), forCellReuseIdentifier: "textFieldCell")
|
||||
tableView.register(UINib(nibName: "TextViewTableViewCell", bundle: nil), forCellReuseIdentifier: "textViewCell")
|
||||
tableView.register(UINib(nibName: "FillPasswordTableViewCell", bundle: nil), forCellReuseIdentifier: "fillPasswordCell")
|
||||
|
||||
|
||||
tableView.rowHeight = UITableViewAutomaticDimension
|
||||
tableView.estimatedRowHeight = 48
|
||||
|
|
@ -31,11 +33,15 @@ class AddPasswordTableViewController: UITableViewController {
|
|||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
if tableTitles[indexPath.section] == "additions" {
|
||||
switch tableTitles[indexPath.section] {
|
||||
case "additions":
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "textViewCell", for: indexPath) as! TextViewTableViewCell
|
||||
cell.contentTextView.text = ""
|
||||
return cell
|
||||
} else {
|
||||
case "password":
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "fillPasswordCell", for: indexPath) as! FillPasswordTableViewCell
|
||||
return cell
|
||||
default:
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "textFieldCell", for: indexPath) as! TextFieldTableViewCell
|
||||
cell.contentTextField.placeholder = tableTitles[indexPath.section]
|
||||
return cell
|
||||
|
|
@ -52,7 +58,7 @@ class AddPasswordTableViewController: UITableViewController {
|
|||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if segue.identifier == "saveAddPasswordSegue" {
|
||||
let nameCell = getCellForName(name: "name")! as! TextFieldTableViewCell
|
||||
let passwordCell = getCellForName(name: "password")! as! TextFieldTableViewCell
|
||||
let passwordCell = getCellForName(name: "password")! as! FillPasswordTableViewCell
|
||||
let additionsCell = getCellForName(name: "additions")! as! TextViewTableViewCell
|
||||
password = Password(name: nameCell.contentTextField.text!, plainText: "\(passwordCell.contentTextField.text!)\n\(additionsCell.contentTextView.text!)")
|
||||
}
|
||||
|
|
|
|||
28
pass/Views/FillPasswordTableViewCell.swift
Normal file
28
pass/Views/FillPasswordTableViewCell.swift
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// FillPasswordTableViewCell.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Mingshen Sun on 11/2/2017.
|
||||
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class FillPasswordTableViewCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var contentTextField: UITextField!
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@IBAction func generatePassword(_ sender: UIButton) {
|
||||
contentTextField.text = "4-r4d0m-p455w0rd"
|
||||
}
|
||||
}
|
||||
55
pass/Views/FillPasswordTableViewCell.xib
Normal file
55
pass/Views/FillPasswordTableViewCell.xib
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="90" id="KGk-i7-Jjw" customClass="FillPasswordTableViewCell" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="89.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="k0U-2N-YaX">
|
||||
<rect key="frame" x="15" y="8" width="297" height="73.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="38" id="qVX-ui-dIn"/>
|
||||
</constraints>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hTh-ek-Xam">
|
||||
<rect key="frame" x="243" y="30.5" width="60" height="29"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<state key="normal" title="Generate"/>
|
||||
<connections>
|
||||
<action selector="generatePassword:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="M61-hs-PCP"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="k0U-2N-YaX" secondAttribute="trailing" id="3S1-gj-XVP"/>
|
||||
<constraint firstItem="hTh-ek-Xam" firstAttribute="centerY" secondItem="k0U-2N-YaX" secondAttribute="centerY" id="Fls-do-khd"/>
|
||||
<constraint firstItem="hTh-ek-Xam" firstAttribute="leading" secondItem="k0U-2N-YaX" secondAttribute="trailing" constant="-69" id="hsy-gb-ero"/>
|
||||
<constraint firstItem="k0U-2N-YaX" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="jKd-Xa-tr5"/>
|
||||
<constraint firstItem="k0U-2N-YaX" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="7" id="lAm-D6-pir"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="k0U-2N-YaX" secondAttribute="bottom" id="pLC-H7-JTU"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="contentTextField" destination="k0U-2N-YaX" id="kQO-tR-Epp"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="34" y="77"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Loading…
Add table
Add a link
Reference in a new issue