Skip to content

Commit 21f376a

Browse files
committed
Expanded example
1 parent 7f89b1a commit 21f376a

File tree

2 files changed

+70
-20
lines changed

2 files changed

+70
-20
lines changed

Example/ActivityIndicatingNavigationItemExample/Base.lproj/Main.storyboard

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="dGZ-Ol-am8">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="dGZ-Ol-am8">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
99
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>
@@ -35,44 +35,79 @@
3535
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
3636
<subviews>
3737
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ADS-B7-JTC">
38-
<rect key="frame" x="0.0" y="64" width="187.5" height="60"/>
38+
<rect key="frame" x="191.5" y="72" width="175.5" height="60"/>
39+
<color key="backgroundColor" red="0.52156862749999999" green="0.73333333329999995" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
40+
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
41+
<state key="normal" title="Animate Save">
42+
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
43+
</state>
44+
<connections>
45+
<action selector="tapStartSave:" destination="BYZ-38-t0r" eventType="touchUpInside" id="GrE-fG-NuL"/>
46+
</connections>
47+
</button>
48+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XxO-ii-0tJ">
49+
<rect key="frame" x="191.5" y="140" width="175.5" height="60"/>
50+
<color key="backgroundColor" red="0.76652234792709351" green="0.47299486398696899" blue="0.46554750204086304" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
51+
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
52+
<state key="normal" title="Stop">
53+
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
54+
</state>
55+
<connections>
56+
<action selector="tapStopSave:" destination="BYZ-38-t0r" eventType="touchUpInside" id="JrL-6V-BPd"/>
57+
</connections>
58+
</button>
59+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EVJ-Iw-XiW">
60+
<rect key="frame" x="8" y="72" width="175.5" height="60"/>
3961
<color key="backgroundColor" red="0.52156862749999999" green="0.73333333329999995" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
4062
<constraints>
41-
<constraint firstAttribute="height" constant="60" id="jDJ-PF-ijv"/>
63+
<constraint firstAttribute="height" constant="60" id="vZq-4O-C9P"/>
4264
</constraints>
4365
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
44-
<state key="normal" title="Start Animating">
66+
<state key="normal" title="Animate Done">
4567
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
4668
</state>
4769
<connections>
48-
<action selector="tapStartAnimating:" destination="BYZ-38-t0r" eventType="touchUpInside" id="7Hv-uN-0Mc"/>
70+
<action selector="tapStartDone:" destination="BYZ-38-t0r" eventType="touchUpInside" id="KFj-27-Z1Q"/>
4971
</connections>
5072
</button>
51-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XxO-ii-0tJ">
52-
<rect key="frame" x="187.5" y="64" width="187.5" height="60"/>
73+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XwC-DV-wx2">
74+
<rect key="frame" x="8" y="140" width="175.5" height="60"/>
5375
<color key="backgroundColor" red="0.70588235290000001" green="0.3921568627" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
5476
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
55-
<state key="normal" title="Stop Animating">
77+
<state key="normal" title="Stop">
5678
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
5779
</state>
5880
<connections>
59-
<action selector="tapStopAnimating:" destination="BYZ-38-t0r" eventType="touchUpInside" id="4ze-ue-PEO"/>
81+
<action selector="tapStopDone:" destination="BYZ-38-t0r" eventType="touchUpInside" id="uni-RL-iDo"/>
6082
</connections>
6183
</button>
6284
</subviews>
6385
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
6486
<constraints>
65-
<constraint firstItem="XxO-ii-0tJ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="I3o-J7-hVC"/>
66-
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="XxO-ii-0tJ" secondAttribute="trailing" id="Jay-4C-B2e"/>
67-
<constraint firstItem="XxO-ii-0tJ" firstAttribute="height" secondItem="ADS-B7-JTC" secondAttribute="height" id="KS8-Hr-lEy"/>
68-
<constraint firstItem="ADS-B7-JTC" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="U7e-50-843"/>
69-
<constraint firstItem="XxO-ii-0tJ" firstAttribute="leading" secondItem="ADS-B7-JTC" secondAttribute="trailing" id="ZrB-p8-cKT"/>
70-
<constraint firstItem="ADS-B7-JTC" firstAttribute="width" secondItem="XxO-ii-0tJ" secondAttribute="width" id="a2Z-QR-yAc"/>
71-
<constraint firstItem="ADS-B7-JTC" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="rQn-4x-Yo4"/>
87+
<constraint firstItem="XxO-ii-0tJ" firstAttribute="leading" secondItem="XwC-DV-wx2" secondAttribute="trailing" constant="8" id="5JQ-eY-ZcV"/>
88+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="XxO-ii-0tJ" secondAttribute="trailing" constant="8" id="5NW-6X-k8I"/>
89+
<constraint firstItem="XwC-DV-wx2" firstAttribute="height" secondItem="EVJ-Iw-XiW" secondAttribute="height" id="6wh-b2-yud"/>
90+
<constraint firstItem="ADS-B7-JTC" firstAttribute="width" secondItem="EVJ-Iw-XiW" secondAttribute="width" id="7ks-RT-1ej"/>
91+
<constraint firstItem="XxO-ii-0tJ" firstAttribute="top" secondItem="ADS-B7-JTC" secondAttribute="bottom" constant="8" id="MaJ-ul-kp0"/>
92+
<constraint firstItem="XxO-ii-0tJ" firstAttribute="height" secondItem="EVJ-Iw-XiW" secondAttribute="height" id="TtD-fq-1Ii"/>
93+
<constraint firstItem="ADS-B7-JTC" firstAttribute="height" secondItem="EVJ-Iw-XiW" secondAttribute="height" id="Zw0-yx-I50"/>
94+
<constraint firstItem="ADS-B7-JTC" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="8" id="bKO-1P-UGf"/>
95+
<constraint firstItem="EVJ-Iw-XiW" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="8" id="beK-0v-TDF"/>
96+
<constraint firstItem="XwC-DV-wx2" firstAttribute="top" secondItem="EVJ-Iw-XiW" secondAttribute="bottom" constant="8" id="caV-ME-5Z3"/>
97+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="ADS-B7-JTC" secondAttribute="trailing" constant="8" id="e0q-7r-BS0"/>
98+
<constraint firstItem="ADS-B7-JTC" firstAttribute="leading" secondItem="EVJ-Iw-XiW" secondAttribute="trailing" constant="8" id="fKH-4L-wmW"/>
99+
<constraint firstItem="XxO-ii-0tJ" firstAttribute="width" secondItem="XwC-DV-wx2" secondAttribute="width" id="jyf-cQ-vBP"/>
100+
<constraint firstItem="XwC-DV-wx2" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="8" id="nFd-GC-GlX"/>
101+
<constraint firstItem="EVJ-Iw-XiW" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="8" id="oD1-Af-xxi"/>
72102
</constraints>
73103
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
74104
</view>
75105
<navigationItem key="navigationItem" id="bcM-Hq-t7q" customClass="ActivityIndicatingNavigationItem" customModule="ActivityIndicatingNavigationItemExample" customModuleProvider="target">
106+
<barButtonItem key="leftBarButtonItem" systemItem="done" id="kjE-UW-dBz">
107+
<connections>
108+
<action selector="tapDone:" destination="BYZ-38-t0r" id="3rq-7d-0lH"/>
109+
</connections>
110+
</barButtonItem>
76111
<barButtonItem key="rightBarButtonItem" systemItem="save" id="pzr-o7-LvA">
77112
<connections>
78113
<action selector="tapSave:" destination="BYZ-38-t0r" id="MA0-W7-JQL"/>

Example/ActivityIndicatingNavigationItemExample/ViewController.swift

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,32 @@ class ViewController: UIViewController {
2121
//
2222
}
2323

24-
// MARK: IBAction
24+
// MARK: IBAction - Right
2525

2626
@IBAction func tapSave(_ sender: UIBarButtonItem) {
2727
activityIndicatingNavigationItem.startAnimating(.right)
2828
}
2929

30-
@IBAction func tapStartAnimating(_ sender: UIButton) {
30+
@IBAction func tapStartSave(_ sender: UIButton) {
3131
activityIndicatingNavigationItem.startAnimating(.right)
3232
}
3333

34-
@IBAction func tapStopAnimating(_ sender: UIButton) {
34+
@IBAction func tapStopSave(_ sender: UIButton) {
3535
activityIndicatingNavigationItem.stopAnimating(.right)
3636
}
37+
38+
// MARK: IBAction - Left
39+
40+
@IBAction func tapDone(_ sender: UIBarButtonItem) {
41+
activityIndicatingNavigationItem.startAnimating(.left)
42+
}
43+
44+
@IBAction func tapStartDone(_ sender: UIButton) {
45+
activityIndicatingNavigationItem.startAnimating(.left)
46+
}
47+
48+
@IBAction func tapStopDone(_ sender: UIButton) {
49+
activityIndicatingNavigationItem.stopAnimating(.left)
50+
}
51+
3752
}

0 commit comments

Comments
 (0)