Skip to content

Commit ee36aa2

Browse files
authored
Update iPhoneGuiExample by using the storyboard (#7876)
1 parent a28c5c3 commit ee36aa2

5 files changed

Lines changed: 139 additions & 111 deletions

File tree

examples/ios/iPhoneGuiExample/src/gui/MyGuiView.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ @implementation MyGuiView
1515
// called automatically after the view is loaded, can be treated like the constructor or setup() of this class
1616
-(void)viewDidLoad {
1717
myApp = (ofApp*)ofGetAppPtr();
18+
// change view size for enable touch event on ofApp
19+
CGRect newFrame = self.view.frame;
20+
newFrame.size.width = self.view.frame.size.width;
21+
newFrame.size.height = 200;
22+
self.view.frame = newFrame;
1823
}
1924

2025
//----------------------------------------------------------------
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina6_12" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<scenes>
12+
<!--My Gui View-->
13+
<scene sceneID="s0d-6b-0kx">
14+
<objects>
15+
<viewController storyboardIdentifier="MyGuiView" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Y6W-OH-hqX" customClass="MyGuiView" sceneMemberID="viewController">
16+
<view key="view" multipleTouchEnabled="YES" contentMode="scaleToFill" id="5EZ-qb-Rvc">
17+
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<subviews>
20+
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="1" verticalHuggingPriority="1" horizontalCompressionResistancePriority="1" verticalCompressionResistancePriority="1" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="8Cm-bt-vl2">
21+
<rect key="frame" x="20" y="69" width="353" height="125.33333333333331"/>
22+
<subviews>
23+
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PRe-o4-Kku">
24+
<rect key="frame" x="0.0" y="0.0" width="353" height="44"/>
25+
<items>
26+
<barButtonItem width="42" style="plain" systemItem="fixedSpace" id="Rzy-Jj-lY0"/>
27+
<barButtonItem style="plain" id="d0E-Kk-csc">
28+
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" id="8Ts-gF-Qgo">
29+
<rect key="frame" x="42" y="4.6666666666666679" width="75" height="35"/>
30+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
31+
<state key="normal" title="Button"/>
32+
<buttonConfiguration key="configuration" style="plain" title="-"/>
33+
<connections>
34+
<action selector="less:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="R7s-a1-b3M"/>
35+
</connections>
36+
</button>
37+
</barButtonItem>
38+
<barButtonItem style="plain" id="eN7-RA-pMs">
39+
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" id="ACQ-Zg-1H2">
40+
<rect key="frame" x="117" y="4.6666666666666679" width="68" height="35"/>
41+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
42+
<state key="normal" title="Button"/>
43+
<buttonConfiguration key="configuration" style="plain" title="+"/>
44+
<connections>
45+
<action selector="more:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="4eE-b9-FW8"/>
46+
</connections>
47+
</button>
48+
</barButtonItem>
49+
<barButtonItem width="42" style="plain" systemItem="fixedSpace" id="RXl-Vv-9RG"/>
50+
<barButtonItem title="Done" id="bZt-3v-bY8">
51+
<connections>
52+
<action selector="hide:" destination="Y6W-OH-hqX" id="pZr-Eo-abl"/>
53+
</connections>
54+
</barButtonItem>
55+
</items>
56+
</toolbar>
57+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="status:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hKP-As-tTp">
58+
<rect key="frame" x="0.0" y="44" width="353" height="20.333333333333329"/>
59+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
60+
<color key="textColor" systemColor="tintColor"/>
61+
<nil key="highlightedColor"/>
62+
</label>
63+
<stackView opaque="NO" contentMode="scaleToFill" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="9z8-mc-G5w">
64+
<rect key="frame" x="0.0" y="64.333333333333343" width="353" height="30"/>
65+
<subviews>
66+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Number of Points" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UVO-YQ-o6G">
67+
<rect key="frame" x="0.0" y="0.0" width="176" height="30"/>
68+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
69+
<color key="textColor" systemColor="tintColor"/>
70+
<nil key="highlightedColor"/>
71+
</label>
72+
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="jo0-gb-CH6">
73+
<rect key="frame" x="184" y="0.0" width="171" height="31"/>
74+
<constraints>
75+
<constraint firstAttribute="width" constant="167" id="NX3-rW-kv2"/>
76+
</constraints>
77+
<connections>
78+
<action selector="adjustPoints:" destination="Y6W-OH-hqX" eventType="valueChanged" id="Nuj-bm-WHT"/>
79+
</connections>
80+
</slider>
81+
</subviews>
82+
</stackView>
83+
<stackView opaque="NO" contentMode="scaleToFill" spacing="23" translatesAutoresizingMaskIntoConstraints="NO" id="54E-JZ-dQw">
84+
<rect key="frame" x="0.0" y="94.333333333333343" width="353" height="31"/>
85+
<subviews>
86+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shape Fill" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4BR-sT-i22">
87+
<rect key="frame" x="0.0" y="0.0" width="281" height="31"/>
88+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
89+
<color key="textColor" systemColor="tintColor"/>
90+
<nil key="highlightedColor"/>
91+
</label>
92+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SGm-hd-zR4">
93+
<rect key="frame" x="304" y="0.0" width="51" height="31"/>
94+
<connections>
95+
<action selector="fillSwitch:" destination="Y6W-OH-hqX" eventType="valueChanged" id="Odm-nj-pqJ"/>
96+
</connections>
97+
</switch>
98+
</subviews>
99+
</stackView>
100+
</subviews>
101+
</stackView>
102+
</subviews>
103+
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
104+
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
105+
<constraints>
106+
<constraint firstItem="8Cm-bt-vl2" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" constant="10" id="YK1-HV-4CI"/>
107+
<constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="8Cm-bt-vl2" secondAttribute="trailing" constant="20" id="cRi-Gk-eAk"/>
108+
<constraint firstItem="8Cm-bt-vl2" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="20" id="xNk-cQ-TkF"/>
109+
</constraints>
110+
</view>
111+
<connections>
112+
<outlet property="displayText" destination="hKP-As-tTp" id="fBN-1z-6Y8"/>
113+
</connections>
114+
</viewController>
115+
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
116+
</objects>
117+
<point key="canvasLocation" x="46.564885496183201" y="-2.1126760563380285"/>
118+
</scene>
119+
</scenes>
120+
<resources>
121+
<systemColor name="tintColor">
122+
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
123+
</systemColor>
124+
</resources>
125+
</document>

examples/ios/iPhoneGuiExample/src/gui/MyGuiView.xib

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)