點數字鍵會 print 出數字
This commit is contained in:
@@ -43,6 +43,9 @@
|
||||
<state key="normal" title="0">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="fKV-LM-t0P"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nAR-KS-hdA">
|
||||
<rect key="frame" x="16" y="469" width="80" height="80"/>
|
||||
@@ -51,6 +54,9 @@
|
||||
<state key="normal" title="1">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="3tS-Vs-uwN"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kDf-qC-jcV">
|
||||
<rect key="frame" x="104" y="469" width="80" height="80"/>
|
||||
@@ -59,6 +65,9 @@
|
||||
<state key="normal" title="2">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="7dd-g7-d1V"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JA3-GM-FCC">
|
||||
<rect key="frame" x="192" y="469" width="80" height="80"/>
|
||||
@@ -67,6 +76,9 @@
|
||||
<state key="normal" title="3">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="SQe-6n-LS3"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lNe-oW-jh1">
|
||||
<rect key="frame" x="16" y="381" width="80" height="80"/>
|
||||
@@ -75,6 +87,9 @@
|
||||
<state key="normal" title="4">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="YHI-GM-GHt"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K0o-vl-kE7">
|
||||
<rect key="frame" x="104" y="381" width="80" height="80"/>
|
||||
@@ -83,6 +98,9 @@
|
||||
<state key="normal" title="5">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="fTX-1h-ZFC"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1p3-kG-6iM">
|
||||
<rect key="frame" x="192" y="381" width="80" height="80"/>
|
||||
@@ -91,6 +109,9 @@
|
||||
<state key="normal" title="6">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dK6-yT-RSF"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wGn-JZ-stq">
|
||||
<rect key="frame" x="16" y="293" width="80" height="80"/>
|
||||
@@ -99,6 +120,9 @@
|
||||
<state key="normal" title="7">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="8jc-pf-wxa"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XMC-8P-7aZ">
|
||||
<rect key="frame" x="104" y="293" width="80" height="80"/>
|
||||
@@ -107,6 +131,9 @@
|
||||
<state key="normal" title="8">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="X0L-rt-8nz"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ePk-jK-elJ">
|
||||
<rect key="frame" x="192" y="293" width="80" height="80"/>
|
||||
@@ -115,6 +142,9 @@
|
||||
<state key="normal" title="9">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickNumberButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5kj-8D-26R"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K66-JV-tKt">
|
||||
<rect key="frame" x="16" y="205" width="80" height="80"/>
|
||||
@@ -175,6 +205,16 @@
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="borderView" destination="srp-dc-mcA" id="ETm-Yj-q7C"/>
|
||||
<outletCollection property="numberButtons" destination="iKJ-gm-pgJ" collectionClass="NSMutableArray" id="pku-qD-GzX"/>
|
||||
<outletCollection property="numberButtons" destination="nAR-KS-hdA" collectionClass="NSMutableArray" id="BPw-Wl-WA0"/>
|
||||
<outletCollection property="numberButtons" destination="kDf-qC-jcV" collectionClass="NSMutableArray" id="DW5-pD-IzB"/>
|
||||
<outletCollection property="numberButtons" destination="JA3-GM-FCC" collectionClass="NSMutableArray" id="E5h-iZ-xb4"/>
|
||||
<outletCollection property="numberButtons" destination="lNe-oW-jh1" collectionClass="NSMutableArray" id="Jl8-WL-0a1"/>
|
||||
<outletCollection property="numberButtons" destination="K0o-vl-kE7" collectionClass="NSMutableArray" id="UdG-7i-Yhk"/>
|
||||
<outletCollection property="numberButtons" destination="1p3-kG-6iM" collectionClass="NSMutableArray" id="Adm-Y9-ZcM"/>
|
||||
<outletCollection property="numberButtons" destination="wGn-JZ-stq" collectionClass="NSMutableArray" id="bA3-Bd-Lw7"/>
|
||||
<outletCollection property="numberButtons" destination="XMC-8P-7aZ" collectionClass="NSMutableArray" id="qd2-ue-ceg"/>
|
||||
<outletCollection property="numberButtons" destination="ePk-jK-elJ" collectionClass="NSMutableArray" id="zOR-Ye-CD7"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -11,6 +11,11 @@ import UIKit
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var borderView: UIView!
|
||||
@IBOutlet var numberButtons: [UIButton]!
|
||||
|
||||
@IBAction func clickNumberButton(_ sender: UIButton) {
|
||||
print(numberButtons.firstIndex(of: sender)!)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
Reference in New Issue
Block a user