Skip to content

Commit 91aa1f1

Browse files
Update demo and documentation on how to create custom dropdown cells
1 parent befee54 commit 91aa1f1

File tree

30 files changed

+295
-25
lines changed

30 files changed

+295
-25
lines changed

Demo/Images.xcassets/AppIcon.appiconset/Contents.json

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"idiom" : "iphone",
515
"size" : "29x29",
@@ -53,6 +63,16 @@
5363
"filename" : "[email protected]",
5464
"scale" : "3x"
5565
},
66+
{
67+
"idiom" : "ipad",
68+
"size" : "20x20",
69+
"scale" : "1x"
70+
},
71+
{
72+
"idiom" : "ipad",
73+
"size" : "20x20",
74+
"scale" : "2x"
75+
},
5676
{
5777
"size" : "29x29",
5878
"idiom" : "ipad",
@@ -118,6 +138,11 @@
118138
"idiom" : "ipad",
119139
"filename" : "[email protected]",
120140
"scale" : "2x"
141+
},
142+
{
143+
"idiom" : "ios-marketing",
144+
"size" : "1024x1024",
145+
"scale" : "1x"
121146
}
122147
],
123148
"info" : {

Demo/Images.xcassets/Contents.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_0.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
385 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_1.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
271 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_10.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
346 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_2.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
358 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_3.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
251 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_4.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
356 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_5.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
256 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_6.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
293 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_7.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
354 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_8.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
295 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "logo_9.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
332 Bytes
Loading

Demo/MyCell.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import DropDown
1111

1212
class MyCell: DropDownCell {
1313

14-
@IBOutlet weak var suffixLabel: UILabel!
14+
@IBOutlet weak var logoImageView: UIImageView!
1515

1616
}

Demo/MyCell.xib

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<objects>
812
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -11,36 +15,35 @@
1115
<rect key="frame" x="0.0" y="0.0" width="210" height="40"/>
1216
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1317
<subviews>
18+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_0" translatesAutoresizingMaskIntoConstraints="NO" id="wwI-k5-kbU">
19+
<rect key="frame" x="8" y="10" width="20" height="20"/>
20+
</imageView>
1421
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="optionLabel" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VIB-Xt-ckX">
15-
<rect key="frame" x="8" y="9" width="90" height="21"/>
22+
<rect key="frame" x="36" y="9" width="90" height="21"/>
1623
<fontDescription key="fontDescription" type="system" pointSize="17"/>
17-
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
18-
<nil key="highlightedColor"/>
19-
</label>
20-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="suffixLabel" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ohS-96-iSV">
21-
<rect key="frame" x="106" y="9" width="84" height="21"/>
22-
<fontDescription key="fontDescription" type="system" pointSize="17"/>
23-
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
24+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2425
<nil key="highlightedColor"/>
2526
</label>
2627
</subviews>
27-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
28+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2829
<constraints>
2930
<constraint firstAttribute="bottom" secondItem="VIB-Xt-ckX" secondAttribute="bottom" constant="10" id="0zj-tF-bzC"/>
30-
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ohS-96-iSV" secondAttribute="trailing" constant="8" id="9Q3-yc-9aj"/>
31-
<constraint firstItem="ohS-96-iSV" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="9" id="K4S-Hy-PP9"/>
32-
<constraint firstItem="VIB-Xt-ckX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="ceQ-YZ-1ri"/>
31+
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="VIB-Xt-ckX" secondAttribute="trailing" constant="8" id="OSg-Aj-BFF"/>
32+
<constraint firstItem="VIB-Xt-ckX" firstAttribute="leading" secondItem="wwI-k5-kbU" secondAttribute="trailing" constant="8" id="aUx-ZS-D4Q"/>
3333
<constraint firstItem="VIB-Xt-ckX" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="9" id="fWz-fu-Ghl"/>
34-
<constraint firstAttribute="bottom" secondItem="ohS-96-iSV" secondAttribute="bottom" constant="10" id="iqG-w5-Bck"/>
35-
<constraint firstItem="ohS-96-iSV" firstAttribute="leading" secondItem="VIB-Xt-ckX" secondAttribute="trailing" constant="8" id="jeo-I3-rzu"/>
34+
<constraint firstItem="wwI-k5-kbU" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="oNR-Ox-93x"/>
35+
<constraint firstItem="wwI-k5-kbU" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="xPu-SG-9dw"/>
3636
</constraints>
3737
<nil key="simulatedStatusBarMetrics"/>
3838
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
3939
<connections>
40+
<outlet property="logoImageView" destination="wwI-k5-kbU" id="DFj-ka-K8K"/>
4041
<outlet property="optionLabel" destination="VIB-Xt-ckX" id="RNH-YD-X7E"/>
41-
<outlet property="suffixLabel" destination="ohS-96-iSV" id="srg-QB-s9S"/>
4242
</connections>
4343
<point key="canvasLocation" x="515" y="409"/>
4444
</view>
4545
</objects>
46+
<resources>
47+
<image name="logo_0" width="20" height="20"/>
48+
</resources>
4649
</document>

0 commit comments

Comments
 (0)