Fix view tag conflicts

This commit is contained in:
Yishi Lin 2017-04-04 00:52:51 +08:00
parent 855e3c34d9
commit a10614341e
2 changed files with 7 additions and 6 deletions

View file

@ -291,7 +291,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/> <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00/00/0000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hj4-EP-LFW"> <label opaque="NO" userInteractionEnabled="NO" tag="201" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00/00/0000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hj4-EP-LFW">
<rect key="frame" x="15" y="8" width="89" height="28"/> <rect key="frame" x="15" y="8" width="89" height="28"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="89" id="jNO-Xy-H99"/> <constraint firstAttribute="width" constant="89" id="jNO-Xy-H99"/>
@ -300,7 +300,7 @@
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Edit password for totp-secret/github.com using vi." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VFa-a4-XsP"> <label opaque="NO" userInteractionEnabled="NO" tag="202" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="commitlog" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VFa-a4-XsP">
<rect key="frame" x="104" y="12.666666666666664" width="302" height="18"/> <rect key="frame" x="104" y="12.666666666666664" width="302" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/> <fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/> <nil key="textColor"/>

View file

@ -30,10 +30,11 @@ class CommitLogsTableViewController: UITableViewController {
formatter.dateStyle = DateFormatter.Style.short formatter.dateStyle = DateFormatter.Style.short
formatter.timeStyle = .none formatter.timeStyle = .none
let dateString = formatter.string(from: commits[indexPath.row].commitDate) let dateString = formatter.string(from: commits[indexPath.row].commitDate)
let dateLabel = cell.viewWithTag(101) as! UILabel
let messageLabel = cell.viewWithTag(102) as! UILabel let dateLabel = cell.contentView.viewWithTag(201) as? UILabel
dateLabel.text = dateString let messageLabel = cell.contentView.viewWithTag(202) as? UILabel
messageLabel.text = commits[indexPath.row].message dateLabel?.text = dateString
messageLabel?.text = commits[indexPath.row].message
return cell return cell
} }
} }