Skip to content

Commit 70864e9

Browse files
author
RYUHEI KAMINISHI
committed
➕ Add how to use
1 parent 47caf0e commit 70864e9

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

Example/Example/Base.lproj/Main.storyboard

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,44 @@
2222
<constraint firstAttribute="height" constant="48" id="xbI-dK-nvD"/>
2323
</constraints>
2424
</view>
25+
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="twq-hS-KKD">
26+
<rect key="frame" x="80" y="354" width="254" height="38"/>
27+
<subviews>
28+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iiI-e1-BfA">
29+
<rect key="frame" x="0.0" y="0.0" width="84.5" height="38"/>
30+
<state key="normal" title="1"/>
31+
<connections>
32+
<action selector="didTap1Button:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5gg-ZK-qHH"/>
33+
</connections>
34+
</button>
35+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xdk-S4-KbX">
36+
<rect key="frame" x="84.5" y="0.0" width="85" height="38"/>
37+
<state key="normal" title="2"/>
38+
<connections>
39+
<action selector="didTap2Button:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hvM-GT-vBp"/>
40+
</connections>
41+
</button>
42+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pnQ-Or-PGT">
43+
<rect key="frame" x="169.5" y="0.0" width="84.5" height="38"/>
44+
<state key="normal" title="3"/>
45+
<connections>
46+
<action selector="didTap3Button:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hSc-g8-75K"/>
47+
</connections>
48+
</button>
49+
</subviews>
50+
<constraints>
51+
<constraint firstAttribute="height" constant="38" id="86t-NV-SRY"/>
52+
<constraint firstItem="pnQ-Or-PGT" firstAttribute="width" secondItem="iiI-e1-BfA" secondAttribute="width" id="PU1-r5-PDD"/>
53+
<constraint firstItem="Xdk-S4-KbX" firstAttribute="width" secondItem="iiI-e1-BfA" secondAttribute="width" id="hX0-rc-sJJ"/>
54+
</constraints>
55+
</stackView>
2556
</subviews>
2657
<color key="backgroundColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
2758
<constraints>
2859
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="rqd-4e-3Tx" secondAttribute="trailing" constant="16" id="9PL-TT-tEx"/>
60+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="twq-hS-KKD" secondAttribute="trailing" constant="80" id="Art-gN-CIF"/>
61+
<constraint firstItem="rqd-4e-3Tx" firstAttribute="top" secondItem="twq-hS-KKD" secondAttribute="bottom" constant="32" id="Er0-XM-itb"/>
62+
<constraint firstItem="twq-hS-KKD" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="80" id="RM6-I7-2QL"/>
2963
<constraint firstItem="rqd-4e-3Tx" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="bIa-KP-Nz0"/>
3064
<constraint firstItem="rqd-4e-3Tx" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="cv6-8o-Ito"/>
3165
<constraint firstItem="rqd-4e-3Tx" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="vnq-AJ-4Vp"/>
@@ -38,7 +72,7 @@
3872
</viewController>
3973
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
4074
</objects>
41-
<point key="canvasLocation" x="139" y="116"/>
75+
<point key="canvasLocation" x="137.68115942028987" y="115.84821428571428"/>
4276
</scene>
4377
</scenes>
4478
</document>

Example/Example/ViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ final class ViewController: UIViewController {
2323
control.isAnimateFocusMoving = true
2424
}
2525

26+
@IBAction func didTap1Button(_ sender: Any) {
27+
control.move(to: 0)
28+
}
29+
30+
@IBAction func didTap2Button(_ sender: Any) {
31+
control.move(to: 1)
32+
}
33+
34+
@IBAction func didTap3Button(_ sender: Any) {
35+
control.move(to: 2)
36+
}
2637

2738
@objc func update(_ sender: FloatingSegmentedControl) {
2839
print("focused index is \(sender.focusedIndex)")

0 commit comments

Comments
 (0)