Testing/Displaying Count
This commit is contained in:
@@ -326,6 +326,9 @@
|
||||
<state key="normal" title="Start">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="start:" destination="PYt-Lf-JNp" eventType="touchUpInside" id="ucf-fN-SgP"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O4A-eq-kEz">
|
||||
<rect key="frame" x="0.0" y="40" width="374" height="30"/>
|
||||
@@ -333,6 +336,9 @@
|
||||
<state key="normal" title="Stop">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="stop:" destination="PYt-Lf-JNp" eventType="touchUpInside" id="ncg-GB-bAj"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Q7i-3U-NbI">
|
||||
<rect key="frame" x="0.0" y="80" width="374" height="30"/>
|
||||
@@ -340,6 +346,9 @@
|
||||
<state key="normal" title="Reset">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="reset:" destination="PYt-Lf-JNp" eventType="touchUpInside" id="3ff-of-rJl"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="794-VN-m96">
|
||||
<rect key="frame" x="0.0" y="120" width="374" height="30"/>
|
||||
@@ -347,6 +356,9 @@
|
||||
<state key="normal" title="Lap">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="lap:" destination="PYt-Lf-JNp" eventType="touchUpInside" id="UT9-pP-BWA"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
|
||||
@@ -24,7 +24,7 @@ class StopwatchViewController: UIViewController {
|
||||
var minutes = 0
|
||||
var seconds = 0
|
||||
|
||||
var lappedTimes: [String] = ["1", "2", "3"]
|
||||
var lappedTimes: [String] = []
|
||||
var timer = Timer()
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -32,7 +32,23 @@ class StopwatchViewController: UIViewController {
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
|
||||
@IBAction func start(_ sender: UIButton) {
|
||||
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(count), userInfo: nil, repeats: true)
|
||||
}
|
||||
|
||||
|
||||
@IBAction func stop(_ sender: UIButton) {
|
||||
}
|
||||
@IBAction func reset(_ sender: UIButton) {
|
||||
}
|
||||
@IBAction func lap(_ sender: UIButton) {
|
||||
}
|
||||
|
||||
@objc fileprivate func count() {
|
||||
seconds += 1
|
||||
print(seconds)
|
||||
}
|
||||
}
|
||||
|
||||
extension StopwatchViewController: UITableViewDelegate, UITableViewDataSource {
|
||||
|
||||
Reference in New Issue
Block a user