├── .gitignore
├── AnimatedDropdownMenu.podspec
├── Examples
├── Examples.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── Examples.xcworkspace
│ └── contents.xcworkspacedata
├── Examples
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── icon_iphone_20@2x.png
│ │ │ ├── icon_iphone_20@3x.png
│ │ │ ├── icon_iphone_29@2x.png
│ │ │ ├── icon_iphone_29@3x.png
│ │ │ ├── icon_iphone_40@2x.png
│ │ │ ├── icon_iphone_40@3x.png
│ │ │ ├── icon_iphone_60@2x.png
│ │ │ └── icon_iphone_60@3x.png
│ │ ├── Contents.json
│ │ ├── MenuIcons
│ │ │ ├── Contents.json
│ │ │ ├── icon_artwork.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_artwork_alpha@2x.png
│ │ │ │ └── icon_artwork_alpha@3x.png
│ │ │ ├── icon_artwork_light.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_artwork_light@2x.png
│ │ │ │ └── icon_artwork_light@3x.png
│ │ │ ├── icon_other.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_other_alpha@2x.png
│ │ │ │ └── icon_other_alpha@3x.png
│ │ │ ├── icon_other_light.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_other_light@2x.png
│ │ │ │ └── icon_other_light@3x.png
│ │ │ ├── icon_photography.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_unsplash_alpha@2x.png
│ │ │ │ └── icon_unsplash_alpha@3x.png
│ │ │ └── icon_photography_light.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon_unsplash_light@2x.png
│ │ │ │ └── icon_unsplash_light@3x.png
│ │ └── icon_logo.imageset
│ │ │ ├── Contents.json
│ │ │ ├── icon_logo@2x.png
│ │ │ └── icon_logo@3x.png
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Extensions
│ │ ├── UIColor+DropdownMenu.swift
│ │ └── UIFont+DropdownMenu.swift
│ ├── Info.plist
│ ├── MenuTypes
│ │ ├── CenterTypeOneViewController.swift
│ │ ├── CenterTypeThreeViewController.swift
│ │ ├── CenterTypeTwoViewController.swift
│ │ ├── LeftTypeFiveViewController.swift
│ │ ├── LeftTypeFourViewController.swift
│ │ ├── LeftTypeOneViewController.swift
│ │ ├── LeftTypeSixViewController.swift
│ │ ├── LeftTypeTreeViewController.swift
│ │ └── LeftTypeTwoViewController.swift
│ ├── MenusList
│ │ ├── MenusListConfig.swift
│ │ ├── MenusListTableViewCell.swift
│ │ ├── MenusListTableViewCell.xib
│ │ └── MenusListViewController.swift
│ └── Navigation
│ │ └── DropdownMenuNavigationController.swift
├── Podfile
├── Podfile.lock
└── Pods
│ ├── AnimatedDropdownMenu
│ ├── LICENSE
│ ├── README.md
│ └── Source
│ │ ├── AnimatedDropdownMenu.bundle
│ │ ├── icon_dropdown_arrow.png
│ │ ├── icon_dropdown_arrow@2x.png
│ │ └── icon_dropdown_arrow@3x.png
│ │ ├── AnimatedDropdownMenu.swift
│ │ ├── DropdownMenuCellSeparator.swift
│ │ ├── DropdownMenuConfig.swift
│ │ ├── DropdownMenuTableView.swift
│ │ └── DropdownMenuTableViewCell.swift
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ └── project.pbxproj
│ └── Target Support Files
│ ├── AnimatedDropdownMenu
│ ├── AnimatedDropdownMenu-dummy.m
│ ├── AnimatedDropdownMenu-prefix.pch
│ ├── AnimatedDropdownMenu-umbrella.h
│ ├── AnimatedDropdownMenu.modulemap
│ ├── AnimatedDropdownMenu.xcconfig
│ └── Info.plist
│ └── Pods-Examples
│ ├── Info.plist
│ ├── Pods-Examples-acknowledgements.markdown
│ ├── Pods-Examples-acknowledgements.plist
│ ├── Pods-Examples-dummy.m
│ ├── Pods-Examples-frameworks.sh
│ ├── Pods-Examples-resources.sh
│ ├── Pods-Examples-umbrella.h
│ ├── Pods-Examples.debug.xcconfig
│ ├── Pods-Examples.modulemap
│ └── Pods-Examples.release.xcconfig
├── LICENSE
├── README.md
└── Source
├── AnimatedDropdownMenu.bundle
├── icon_dropdown_arrow.png
├── icon_dropdown_arrow@2x.png
└── icon_dropdown_arrow@3x.png
├── AnimatedDropdownMenu.swift
├── DropdownMenuCellSeparator.swift
├── DropdownMenuConfig.swift
├── DropdownMenuTableView.swift
└── DropdownMenuTableViewCell.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 | .DS_Store
20 |
21 | # CocoaPods
22 | #
23 | # We recommend against adding the Pods directory to your .gitignore. However
24 | # you should judge for yourself, the pros and cons are mentioned at:
25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
26 | #
27 | #Examples/Pods/
28 |
29 | # Carthage
30 | #
31 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
32 | # Carthage/Checkouts
33 |
34 | Carthage/Build
35 | xcshareddata
36 | fastlane
37 |
--------------------------------------------------------------------------------
/AnimatedDropdownMenu.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'AnimatedDropdownMenu'
3 | s.version = '0.3.3'
4 | s.summary = 'A clean interface dropdown menu used on iOS.'
5 | s.description = <<-DESC
6 | AnimatedDropdownMenu is a clean interface dropdown menu, appears underneath navigation bar to display a list of related items when you click on the navigation title.
7 | DESC
8 | s.homepage = 'https://github.com/JonyFang/AnimatedDropdownMenu'
9 | s.license = 'MIT'
10 | s.authors = { 'JonyFang' => 'jony.chunfang@gmail.com' }
11 | s.source = { :git => 'https://github.com/JonyFang/AnimatedDropdownMenu.git', :tag => s.version.to_s }
12 |
13 | s.platform = :ios, '8.0'
14 | s.requires_arc = true
15 |
16 | s.source_files = 'Source/*.swift'
17 | s.resources = 'Source/*.bundle'
18 | end
19 |
--------------------------------------------------------------------------------
/Examples/Examples.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 245C1D285D985B4A128DD1C6 /* Pods_Examples.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB879F16762A78A0D868D081 /* Pods_Examples.framework */; };
11 | D32B705C1E6ACC7500BD2D2B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B705B1E6ACC7500BD2D2B /* AppDelegate.swift */; };
12 | D32B70611E6ACC7500BD2D2B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D32B705F1E6ACC7500BD2D2B /* Main.storyboard */; };
13 | D32B70631E6ACC7500BD2D2B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D32B70621E6ACC7500BD2D2B /* Assets.xcassets */; };
14 | D32B70661E6ACC7500BD2D2B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D32B70641E6ACC7500BD2D2B /* LaunchScreen.storyboard */; };
15 | D32B70721E6ACD0500BD2D2B /* MenusListConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B706E1E6ACD0500BD2D2B /* MenusListConfig.swift */; };
16 | D32B70731E6ACD0500BD2D2B /* MenusListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B706F1E6ACD0500BD2D2B /* MenusListTableViewCell.swift */; };
17 | D32B70741E6ACD0500BD2D2B /* MenusListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D32B70701E6ACD0500BD2D2B /* MenusListTableViewCell.xib */; };
18 | D32B70751E6ACD0500BD2D2B /* MenusListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B70711E6ACD0500BD2D2B /* MenusListViewController.swift */; };
19 | D32B70801E6ACD8800BD2D2B /* CenterTypeOneViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B70771E6ACD8800BD2D2B /* CenterTypeOneViewController.swift */; };
20 | D32B70811E6ACD8800BD2D2B /* CenterTypeThreeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B70781E6ACD8800BD2D2B /* CenterTypeThreeViewController.swift */; };
21 | D32B70821E6ACD8800BD2D2B /* CenterTypeTwoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B70791E6ACD8800BD2D2B /* CenterTypeTwoViewController.swift */; };
22 | D32B70831E6ACD8800BD2D2B /* LeftTypeFiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707A1E6ACD8800BD2D2B /* LeftTypeFiveViewController.swift */; };
23 | D32B70841E6ACD8800BD2D2B /* LeftTypeFourViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707B1E6ACD8800BD2D2B /* LeftTypeFourViewController.swift */; };
24 | D32B70851E6ACD8800BD2D2B /* LeftTypeOneViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707C1E6ACD8800BD2D2B /* LeftTypeOneViewController.swift */; };
25 | D32B70861E6ACD8800BD2D2B /* LeftTypeSixViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707D1E6ACD8800BD2D2B /* LeftTypeSixViewController.swift */; };
26 | D32B70871E6ACD8800BD2D2B /* LeftTypeTreeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707E1E6ACD8800BD2D2B /* LeftTypeTreeViewController.swift */; };
27 | D32B70881E6ACD8800BD2D2B /* LeftTypeTwoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B707F1E6ACD8800BD2D2B /* LeftTypeTwoViewController.swift */; };
28 | D32B708B1E6ACDB400BD2D2B /* DropdownMenuNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B708A1E6ACDB400BD2D2B /* DropdownMenuNavigationController.swift */; };
29 | D32B708F1E6ACDD600BD2D2B /* UIColor+DropdownMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B708D1E6ACDD600BD2D2B /* UIColor+DropdownMenu.swift */; };
30 | D32B70901E6ACDD600BD2D2B /* UIFont+DropdownMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D32B708E1E6ACDD600BD2D2B /* UIFont+DropdownMenu.swift */; };
31 | /* End PBXBuildFile section */
32 |
33 | /* Begin PBXFileReference section */
34 | 755C08A26AB5BEF921463BA9 /* Pods-Examples.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Examples.release.xcconfig"; path = "Pods/Target Support Files/Pods-Examples/Pods-Examples.release.xcconfig"; sourceTree = ""; };
35 | B8ADED27C388BAE5D209C70A /* Pods-Examples.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Examples.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Examples/Pods-Examples.debug.xcconfig"; sourceTree = ""; };
36 | D32B70581E6ACC7500BD2D2B /* Examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Examples.app; sourceTree = BUILT_PRODUCTS_DIR; };
37 | D32B705B1E6ACC7500BD2D2B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
38 | D32B70601E6ACC7500BD2D2B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | D32B70621E6ACC7500BD2D2B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
40 | D32B70651E6ACC7500BD2D2B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
41 | D32B70671E6ACC7500BD2D2B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
42 | D32B706E1E6ACD0500BD2D2B /* MenusListConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenusListConfig.swift; sourceTree = ""; };
43 | D32B706F1E6ACD0500BD2D2B /* MenusListTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenusListTableViewCell.swift; sourceTree = ""; };
44 | D32B70701E6ACD0500BD2D2B /* MenusListTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MenusListTableViewCell.xib; sourceTree = ""; };
45 | D32B70711E6ACD0500BD2D2B /* MenusListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenusListViewController.swift; sourceTree = ""; };
46 | D32B70771E6ACD8800BD2D2B /* CenterTypeOneViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CenterTypeOneViewController.swift; sourceTree = ""; };
47 | D32B70781E6ACD8800BD2D2B /* CenterTypeThreeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CenterTypeThreeViewController.swift; sourceTree = ""; };
48 | D32B70791E6ACD8800BD2D2B /* CenterTypeTwoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CenterTypeTwoViewController.swift; sourceTree = ""; };
49 | D32B707A1E6ACD8800BD2D2B /* LeftTypeFiveViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeFiveViewController.swift; sourceTree = ""; };
50 | D32B707B1E6ACD8800BD2D2B /* LeftTypeFourViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeFourViewController.swift; sourceTree = ""; };
51 | D32B707C1E6ACD8800BD2D2B /* LeftTypeOneViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeOneViewController.swift; sourceTree = ""; };
52 | D32B707D1E6ACD8800BD2D2B /* LeftTypeSixViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeSixViewController.swift; sourceTree = ""; };
53 | D32B707E1E6ACD8800BD2D2B /* LeftTypeTreeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeTreeViewController.swift; sourceTree = ""; };
54 | D32B707F1E6ACD8800BD2D2B /* LeftTypeTwoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftTypeTwoViewController.swift; sourceTree = ""; };
55 | D32B708A1E6ACDB400BD2D2B /* DropdownMenuNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DropdownMenuNavigationController.swift; sourceTree = ""; };
56 | D32B708D1E6ACDD600BD2D2B /* UIColor+DropdownMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+DropdownMenu.swift"; sourceTree = ""; };
57 | D32B708E1E6ACDD600BD2D2B /* UIFont+DropdownMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIFont+DropdownMenu.swift"; sourceTree = ""; };
58 | EB879F16762A78A0D868D081 /* Pods_Examples.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Examples.framework; sourceTree = BUILT_PRODUCTS_DIR; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | D32B70551E6ACC7500BD2D2B /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | 245C1D285D985B4A128DD1C6 /* Pods_Examples.framework in Frameworks */,
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | /* End PBXFrameworksBuildPhase section */
71 |
72 | /* Begin PBXGroup section */
73 | 4467026B6D0608EC4B27E78C /* Pods */ = {
74 | isa = PBXGroup;
75 | children = (
76 | B8ADED27C388BAE5D209C70A /* Pods-Examples.debug.xcconfig */,
77 | 755C08A26AB5BEF921463BA9 /* Pods-Examples.release.xcconfig */,
78 | );
79 | name = Pods;
80 | sourceTree = "";
81 | };
82 | D32B704F1E6ACC7500BD2D2B = {
83 | isa = PBXGroup;
84 | children = (
85 | D32B705A1E6ACC7500BD2D2B /* Examples */,
86 | D32B70591E6ACC7500BD2D2B /* Products */,
87 | 4467026B6D0608EC4B27E78C /* Pods */,
88 | F5532EE51E46D9FB46386CE9 /* Frameworks */,
89 | );
90 | sourceTree = "";
91 | };
92 | D32B70591E6ACC7500BD2D2B /* Products */ = {
93 | isa = PBXGroup;
94 | children = (
95 | D32B70581E6ACC7500BD2D2B /* Examples.app */,
96 | );
97 | name = Products;
98 | sourceTree = "";
99 | };
100 | D32B705A1E6ACC7500BD2D2B /* Examples */ = {
101 | isa = PBXGroup;
102 | children = (
103 | D32B705B1E6ACC7500BD2D2B /* AppDelegate.swift */,
104 | D32B70891E6ACDA700BD2D2B /* Navigation */,
105 | D32B706D1E6ACCEC00BD2D2B /* MenusList */,
106 | D32B70761E6ACD7E00BD2D2B /* MenuTypes */,
107 | D32B708C1E6ACDC700BD2D2B /* Extensions */,
108 | D32B705F1E6ACC7500BD2D2B /* Main.storyboard */,
109 | D32B70621E6ACC7500BD2D2B /* Assets.xcassets */,
110 | D32B70641E6ACC7500BD2D2B /* LaunchScreen.storyboard */,
111 | D32B70671E6ACC7500BD2D2B /* Info.plist */,
112 | );
113 | path = Examples;
114 | sourceTree = "";
115 | };
116 | D32B706D1E6ACCEC00BD2D2B /* MenusList */ = {
117 | isa = PBXGroup;
118 | children = (
119 | D32B706E1E6ACD0500BD2D2B /* MenusListConfig.swift */,
120 | D32B706F1E6ACD0500BD2D2B /* MenusListTableViewCell.swift */,
121 | D32B70701E6ACD0500BD2D2B /* MenusListTableViewCell.xib */,
122 | D32B70711E6ACD0500BD2D2B /* MenusListViewController.swift */,
123 | );
124 | path = MenusList;
125 | sourceTree = "";
126 | };
127 | D32B70761E6ACD7E00BD2D2B /* MenuTypes */ = {
128 | isa = PBXGroup;
129 | children = (
130 | D32B70771E6ACD8800BD2D2B /* CenterTypeOneViewController.swift */,
131 | D32B70791E6ACD8800BD2D2B /* CenterTypeTwoViewController.swift */,
132 | D32B70781E6ACD8800BD2D2B /* CenterTypeThreeViewController.swift */,
133 | D32B707C1E6ACD8800BD2D2B /* LeftTypeOneViewController.swift */,
134 | D32B707F1E6ACD8800BD2D2B /* LeftTypeTwoViewController.swift */,
135 | D32B707E1E6ACD8800BD2D2B /* LeftTypeTreeViewController.swift */,
136 | D32B707B1E6ACD8800BD2D2B /* LeftTypeFourViewController.swift */,
137 | D32B707A1E6ACD8800BD2D2B /* LeftTypeFiveViewController.swift */,
138 | D32B707D1E6ACD8800BD2D2B /* LeftTypeSixViewController.swift */,
139 | );
140 | path = MenuTypes;
141 | sourceTree = "";
142 | };
143 | D32B70891E6ACDA700BD2D2B /* Navigation */ = {
144 | isa = PBXGroup;
145 | children = (
146 | D32B708A1E6ACDB400BD2D2B /* DropdownMenuNavigationController.swift */,
147 | );
148 | path = Navigation;
149 | sourceTree = "";
150 | };
151 | D32B708C1E6ACDC700BD2D2B /* Extensions */ = {
152 | isa = PBXGroup;
153 | children = (
154 | D32B708D1E6ACDD600BD2D2B /* UIColor+DropdownMenu.swift */,
155 | D32B708E1E6ACDD600BD2D2B /* UIFont+DropdownMenu.swift */,
156 | );
157 | path = Extensions;
158 | sourceTree = "";
159 | };
160 | F5532EE51E46D9FB46386CE9 /* Frameworks */ = {
161 | isa = PBXGroup;
162 | children = (
163 | EB879F16762A78A0D868D081 /* Pods_Examples.framework */,
164 | );
165 | name = Frameworks;
166 | sourceTree = "";
167 | };
168 | /* End PBXGroup section */
169 |
170 | /* Begin PBXNativeTarget section */
171 | D32B70571E6ACC7500BD2D2B /* Examples */ = {
172 | isa = PBXNativeTarget;
173 | buildConfigurationList = D32B706A1E6ACC7500BD2D2B /* Build configuration list for PBXNativeTarget "Examples" */;
174 | buildPhases = (
175 | 20F93E7BBC1AF5A77F8CF25B /* [CP] Check Pods Manifest.lock */,
176 | D32B70541E6ACC7500BD2D2B /* Sources */,
177 | D32B70551E6ACC7500BD2D2B /* Frameworks */,
178 | D32B70561E6ACC7500BD2D2B /* Resources */,
179 | 222EC72F8CC2454223CD94ED /* [CP] Embed Pods Frameworks */,
180 | 473AA3A0352EE655CA4C3B83 /* [CP] Copy Pods Resources */,
181 | );
182 | buildRules = (
183 | );
184 | dependencies = (
185 | );
186 | name = Examples;
187 | productName = Examples;
188 | productReference = D32B70581E6ACC7500BD2D2B /* Examples.app */;
189 | productType = "com.apple.product-type.application";
190 | };
191 | /* End PBXNativeTarget section */
192 |
193 | /* Begin PBXProject section */
194 | D32B70501E6ACC7500BD2D2B /* Project object */ = {
195 | isa = PBXProject;
196 | attributes = {
197 | LastSwiftUpdateCheck = 0820;
198 | LastUpgradeCheck = 0820;
199 | ORGANIZATIONNAME = JonyFang;
200 | TargetAttributes = {
201 | D32B70571E6ACC7500BD2D2B = {
202 | CreatedOnToolsVersion = 8.2.1;
203 | DevelopmentTeam = 26SQZQ89WS;
204 | ProvisioningStyle = Automatic;
205 | };
206 | };
207 | };
208 | buildConfigurationList = D32B70531E6ACC7500BD2D2B /* Build configuration list for PBXProject "Examples" */;
209 | compatibilityVersion = "Xcode 3.2";
210 | developmentRegion = English;
211 | hasScannedForEncodings = 0;
212 | knownRegions = (
213 | en,
214 | Base,
215 | );
216 | mainGroup = D32B704F1E6ACC7500BD2D2B;
217 | productRefGroup = D32B70591E6ACC7500BD2D2B /* Products */;
218 | projectDirPath = "";
219 | projectRoot = "";
220 | targets = (
221 | D32B70571E6ACC7500BD2D2B /* Examples */,
222 | );
223 | };
224 | /* End PBXProject section */
225 |
226 | /* Begin PBXResourcesBuildPhase section */
227 | D32B70561E6ACC7500BD2D2B /* Resources */ = {
228 | isa = PBXResourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | D32B70661E6ACC7500BD2D2B /* LaunchScreen.storyboard in Resources */,
232 | D32B70631E6ACC7500BD2D2B /* Assets.xcassets in Resources */,
233 | D32B70741E6ACD0500BD2D2B /* MenusListTableViewCell.xib in Resources */,
234 | D32B70611E6ACC7500BD2D2B /* Main.storyboard in Resources */,
235 | );
236 | runOnlyForDeploymentPostprocessing = 0;
237 | };
238 | /* End PBXResourcesBuildPhase section */
239 |
240 | /* Begin PBXShellScriptBuildPhase section */
241 | 20F93E7BBC1AF5A77F8CF25B /* [CP] Check Pods Manifest.lock */ = {
242 | isa = PBXShellScriptBuildPhase;
243 | buildActionMask = 2147483647;
244 | files = (
245 | );
246 | inputPaths = (
247 | );
248 | name = "[CP] Check Pods Manifest.lock";
249 | outputPaths = (
250 | );
251 | runOnlyForDeploymentPostprocessing = 0;
252 | shellPath = /bin/sh;
253 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
254 | showEnvVarsInLog = 0;
255 | };
256 | 222EC72F8CC2454223CD94ED /* [CP] Embed Pods Frameworks */ = {
257 | isa = PBXShellScriptBuildPhase;
258 | buildActionMask = 2147483647;
259 | files = (
260 | );
261 | inputPaths = (
262 | );
263 | name = "[CP] Embed Pods Frameworks";
264 | outputPaths = (
265 | );
266 | runOnlyForDeploymentPostprocessing = 0;
267 | shellPath = /bin/sh;
268 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-frameworks.sh\"\n";
269 | showEnvVarsInLog = 0;
270 | };
271 | 473AA3A0352EE655CA4C3B83 /* [CP] Copy Pods Resources */ = {
272 | isa = PBXShellScriptBuildPhase;
273 | buildActionMask = 2147483647;
274 | files = (
275 | );
276 | inputPaths = (
277 | );
278 | name = "[CP] Copy Pods Resources";
279 | outputPaths = (
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | shellPath = /bin/sh;
283 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-resources.sh\"\n";
284 | showEnvVarsInLog = 0;
285 | };
286 | /* End PBXShellScriptBuildPhase section */
287 |
288 | /* Begin PBXSourcesBuildPhase section */
289 | D32B70541E6ACC7500BD2D2B /* Sources */ = {
290 | isa = PBXSourcesBuildPhase;
291 | buildActionMask = 2147483647;
292 | files = (
293 | D32B70851E6ACD8800BD2D2B /* LeftTypeOneViewController.swift in Sources */,
294 | D32B70811E6ACD8800BD2D2B /* CenterTypeThreeViewController.swift in Sources */,
295 | D32B70871E6ACD8800BD2D2B /* LeftTypeTreeViewController.swift in Sources */,
296 | D32B70721E6ACD0500BD2D2B /* MenusListConfig.swift in Sources */,
297 | D32B70841E6ACD8800BD2D2B /* LeftTypeFourViewController.swift in Sources */,
298 | D32B70831E6ACD8800BD2D2B /* LeftTypeFiveViewController.swift in Sources */,
299 | D32B70901E6ACDD600BD2D2B /* UIFont+DropdownMenu.swift in Sources */,
300 | D32B70881E6ACD8800BD2D2B /* LeftTypeTwoViewController.swift in Sources */,
301 | D32B708B1E6ACDB400BD2D2B /* DropdownMenuNavigationController.swift in Sources */,
302 | D32B70731E6ACD0500BD2D2B /* MenusListTableViewCell.swift in Sources */,
303 | D32B708F1E6ACDD600BD2D2B /* UIColor+DropdownMenu.swift in Sources */,
304 | D32B70801E6ACD8800BD2D2B /* CenterTypeOneViewController.swift in Sources */,
305 | D32B70861E6ACD8800BD2D2B /* LeftTypeSixViewController.swift in Sources */,
306 | D32B70821E6ACD8800BD2D2B /* CenterTypeTwoViewController.swift in Sources */,
307 | D32B705C1E6ACC7500BD2D2B /* AppDelegate.swift in Sources */,
308 | D32B70751E6ACD0500BD2D2B /* MenusListViewController.swift in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | /* End PBXSourcesBuildPhase section */
313 |
314 | /* Begin PBXVariantGroup section */
315 | D32B705F1E6ACC7500BD2D2B /* Main.storyboard */ = {
316 | isa = PBXVariantGroup;
317 | children = (
318 | D32B70601E6ACC7500BD2D2B /* Base */,
319 | );
320 | name = Main.storyboard;
321 | sourceTree = "";
322 | };
323 | D32B70641E6ACC7500BD2D2B /* LaunchScreen.storyboard */ = {
324 | isa = PBXVariantGroup;
325 | children = (
326 | D32B70651E6ACC7500BD2D2B /* Base */,
327 | );
328 | name = LaunchScreen.storyboard;
329 | sourceTree = "";
330 | };
331 | /* End PBXVariantGroup section */
332 |
333 | /* Begin XCBuildConfiguration section */
334 | D32B70681E6ACC7500BD2D2B /* Debug */ = {
335 | isa = XCBuildConfiguration;
336 | buildSettings = {
337 | ALWAYS_SEARCH_USER_PATHS = NO;
338 | CLANG_ANALYZER_NONNULL = YES;
339 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
340 | CLANG_CXX_LIBRARY = "libc++";
341 | CLANG_ENABLE_MODULES = YES;
342 | CLANG_ENABLE_OBJC_ARC = YES;
343 | CLANG_WARN_BOOL_CONVERSION = YES;
344 | CLANG_WARN_CONSTANT_CONVERSION = YES;
345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
346 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
347 | CLANG_WARN_EMPTY_BODY = YES;
348 | CLANG_WARN_ENUM_CONVERSION = YES;
349 | CLANG_WARN_INFINITE_RECURSION = YES;
350 | CLANG_WARN_INT_CONVERSION = YES;
351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
352 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
353 | CLANG_WARN_UNREACHABLE_CODE = YES;
354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
355 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
356 | COPY_PHASE_STRIP = NO;
357 | DEBUG_INFORMATION_FORMAT = dwarf;
358 | ENABLE_STRICT_OBJC_MSGSEND = YES;
359 | ENABLE_TESTABILITY = YES;
360 | GCC_C_LANGUAGE_STANDARD = gnu99;
361 | GCC_DYNAMIC_NO_PIC = NO;
362 | GCC_NO_COMMON_BLOCKS = YES;
363 | GCC_OPTIMIZATION_LEVEL = 0;
364 | GCC_PREPROCESSOR_DEFINITIONS = (
365 | "DEBUG=1",
366 | "$(inherited)",
367 | );
368 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
369 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
370 | GCC_WARN_UNDECLARED_SELECTOR = YES;
371 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
372 | GCC_WARN_UNUSED_FUNCTION = YES;
373 | GCC_WARN_UNUSED_VARIABLE = YES;
374 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
375 | MTL_ENABLE_DEBUG_INFO = YES;
376 | ONLY_ACTIVE_ARCH = YES;
377 | SDKROOT = iphoneos;
378 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
379 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
380 | };
381 | name = Debug;
382 | };
383 | D32B70691E6ACC7500BD2D2B /* Release */ = {
384 | isa = XCBuildConfiguration;
385 | buildSettings = {
386 | ALWAYS_SEARCH_USER_PATHS = NO;
387 | CLANG_ANALYZER_NONNULL = YES;
388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
389 | CLANG_CXX_LIBRARY = "libc++";
390 | CLANG_ENABLE_MODULES = YES;
391 | CLANG_ENABLE_OBJC_ARC = YES;
392 | CLANG_WARN_BOOL_CONVERSION = YES;
393 | CLANG_WARN_CONSTANT_CONVERSION = YES;
394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
395 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
396 | CLANG_WARN_EMPTY_BODY = YES;
397 | CLANG_WARN_ENUM_CONVERSION = YES;
398 | CLANG_WARN_INFINITE_RECURSION = YES;
399 | CLANG_WARN_INT_CONVERSION = YES;
400 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
401 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
402 | CLANG_WARN_UNREACHABLE_CODE = YES;
403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
405 | COPY_PHASE_STRIP = NO;
406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
407 | ENABLE_NS_ASSERTIONS = NO;
408 | ENABLE_STRICT_OBJC_MSGSEND = YES;
409 | GCC_C_LANGUAGE_STANDARD = gnu99;
410 | GCC_NO_COMMON_BLOCKS = YES;
411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
413 | GCC_WARN_UNDECLARED_SELECTOR = YES;
414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
415 | GCC_WARN_UNUSED_FUNCTION = YES;
416 | GCC_WARN_UNUSED_VARIABLE = YES;
417 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
418 | MTL_ENABLE_DEBUG_INFO = NO;
419 | SDKROOT = iphoneos;
420 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
421 | VALIDATE_PRODUCT = YES;
422 | };
423 | name = Release;
424 | };
425 | D32B706B1E6ACC7500BD2D2B /* Debug */ = {
426 | isa = XCBuildConfiguration;
427 | baseConfigurationReference = B8ADED27C388BAE5D209C70A /* Pods-Examples.debug.xcconfig */;
428 | buildSettings = {
429 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
431 | DEVELOPMENT_TEAM = 26SQZQ89WS;
432 | INFOPLIST_FILE = Examples/Info.plist;
433 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
434 | PRODUCT_BUNDLE_IDENTIFIER = JonyFang.Examples;
435 | PRODUCT_NAME = "$(TARGET_NAME)";
436 | SWIFT_VERSION = 3.0;
437 | };
438 | name = Debug;
439 | };
440 | D32B706C1E6ACC7500BD2D2B /* Release */ = {
441 | isa = XCBuildConfiguration;
442 | baseConfigurationReference = 755C08A26AB5BEF921463BA9 /* Pods-Examples.release.xcconfig */;
443 | buildSettings = {
444 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
446 | DEVELOPMENT_TEAM = 26SQZQ89WS;
447 | INFOPLIST_FILE = Examples/Info.plist;
448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
449 | PRODUCT_BUNDLE_IDENTIFIER = JonyFang.Examples;
450 | PRODUCT_NAME = "$(TARGET_NAME)";
451 | SWIFT_VERSION = 3.0;
452 | };
453 | name = Release;
454 | };
455 | /* End XCBuildConfiguration section */
456 |
457 | /* Begin XCConfigurationList section */
458 | D32B70531E6ACC7500BD2D2B /* Build configuration list for PBXProject "Examples" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | D32B70681E6ACC7500BD2D2B /* Debug */,
462 | D32B70691E6ACC7500BD2D2B /* Release */,
463 | );
464 | defaultConfigurationIsVisible = 0;
465 | defaultConfigurationName = Release;
466 | };
467 | D32B706A1E6ACC7500BD2D2B /* Build configuration list for PBXNativeTarget "Examples" */ = {
468 | isa = XCConfigurationList;
469 | buildConfigurations = (
470 | D32B706B1E6ACC7500BD2D2B /* Debug */,
471 | D32B706C1E6ACC7500BD2D2B /* Release */,
472 | );
473 | defaultConfigurationIsVisible = 0;
474 | defaultConfigurationName = Release;
475 | };
476 | /* End XCConfigurationList section */
477 | };
478 | rootObject = D32B70501E6ACC7500BD2D2B /* Project object */;
479 | }
480 |
--------------------------------------------------------------------------------
/Examples/Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Examples/Examples.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Examples/Examples/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Examples
4 | //
5 | // Created by JonyFang on 17/3/4.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "icon_iphone_20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "icon_iphone_20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon_iphone_29@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "icon_iphone_29@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon_iphone_40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "icon_iphone_40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "icon_iphone_60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon_iphone_60@3x.png",
49 | "scale" : "3x"
50 | }
51 | ],
52 | "info" : {
53 | "version" : 1,
54 | "author" : "xcode"
55 | }
56 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_20@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_20@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_29@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_29@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_40@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_40@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_60@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/AppIcon.appiconset/icon_iphone_60@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_artwork_alpha@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_artwork_alpha@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork.imageset/icon_artwork_alpha@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork.imageset/icon_artwork_alpha@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork.imageset/icon_artwork_alpha@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork.imageset/icon_artwork_alpha@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork_light.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_artwork_light@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_artwork_light@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork_light.imageset/icon_artwork_light@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork_light.imageset/icon_artwork_light@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork_light.imageset/icon_artwork_light@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_artwork_light.imageset/icon_artwork_light@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_other_alpha@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_other_alpha@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other.imageset/icon_other_alpha@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_other.imageset/icon_other_alpha@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other.imageset/icon_other_alpha@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_other.imageset/icon_other_alpha@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other_light.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_other_light@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_other_light@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other_light.imageset/icon_other_light@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_other_light.imageset/icon_other_light@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_other_light.imageset/icon_other_light@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_other_light.imageset/icon_other_light@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_unsplash_alpha@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_unsplash_alpha@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography.imageset/icon_unsplash_alpha@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography.imageset/icon_unsplash_alpha@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography.imageset/icon_unsplash_alpha@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography.imageset/icon_unsplash_alpha@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography_light.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_unsplash_light@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_unsplash_light@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography_light.imageset/icon_unsplash_light@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography_light.imageset/icon_unsplash_light@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography_light.imageset/icon_unsplash_light@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/MenuIcons/icon_photography_light.imageset/icon_unsplash_light@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/icon_logo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_logo@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_logo@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/icon_logo.imageset/icon_logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/icon_logo.imageset/icon_logo@2x.png
--------------------------------------------------------------------------------
/Examples/Examples/Assets.xcassets/icon_logo.imageset/icon_logo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Examples/Assets.xcassets/icon_logo.imageset/icon_logo@3x.png
--------------------------------------------------------------------------------
/Examples/Examples/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Examples/Examples/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Examples/Examples/Extensions/UIColor+DropdownMenu.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+DropdownMenu.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/1.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | extension UIColor {
12 |
13 | class func menuLightGrayColor() -> UIColor {
14 | return UIColor(red: 95/255.0, green: 105/255.0, blue: 117/255.0, alpha: 1.0)
15 | }
16 |
17 | class func menuDarkGrayColor() -> UIColor {
18 | return UIColor(red: 49/255.0, green: 59/255.0, blue: 71/255.0, alpha: 1.0)
19 | }
20 |
21 | class func menuLightTextColor() -> UIColor {
22 | return UIColor(red: 245/255.0, green: 245/255.0, blue: 245/255.0, alpha: 1.0)
23 | }
24 |
25 | class func menuLightRedColor() -> UIColor {
26 | return UIColor(red: 216/255.0, green: 85/255.0, blue: 96/255.0, alpha: 1.0)
27 | }
28 |
29 | class func menuDarkRedColor() -> UIColor {
30 | return UIColor(red: 160/255.0, green: 61/255.0, blue: 73/255.0, alpha: 1.0)
31 | }
32 |
33 | class func menuPurpleColor() -> UIColor {
34 | return UIColor(red: 143/255.0, green: 69/255.0, blue: 163/255.0, alpha: 1.0)
35 | }
36 |
37 | class func menuGreenColor() -> UIColor {
38 | return UIColor(red: 0, green: 162/255.0, blue: 138/255.0, alpha: 1.0)
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Examples/Examples/Extensions/UIFont+DropdownMenu.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIFont+DropdownMenu.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/1.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | extension UIFont {
12 |
13 | class func navigationBarTitleFont() -> UIFont {
14 | return UIFont.boldSystemFont(ofSize: 16.0)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Examples/Examples/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/CenterTypeOneViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CenterTypeOneViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class CenterTypeOneViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
17 | AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
18 | AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuGreenColor()
54 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
55 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
56 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
57 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellTextAlignment = .center
59 | dropdownMenu.cellSeparatorColor = .clear
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuGreenColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/CenterTypeThreeViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CenterTypeThreeViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class CenterTypeThreeViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
17 | AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
18 | AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuPurpleColor()
54 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
55 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
56 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
57 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellSeparatorColor = UIColor.init(white: 1.0, alpha: 0.1)
59 | dropdownMenu.cellTextAlignment = .center
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuPurpleColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/CenterTypeTwoViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CenterTypeTwoViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class CenterTypeTwoViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
17 | AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
18 | AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuLightRedColor()
54 | dropdownMenu.cellSelectedColor = UIColor.menuDarkRedColor()
55 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
56 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
57 | dropdownMenu.cellTextColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellTextAlignment = .center
59 | dropdownMenu.cellSeparatorColor = .clear
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuLightRedColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeFiveViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeFiveViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeFiveViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography", nil, nil),
17 | AnimatedDropdownMenu.Item.init("From | Artwork", nil, nil),
18 | AnimatedDropdownMenu.Item.init("Others", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuLightRedColor()
54 | dropdownMenu.cellSelectedColor = UIColor.menuDarkRedColor()
55 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
56 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
57 | dropdownMenu.cellTextColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellTextAlignment = .left
59 | dropdownMenu.cellSeparatorColor = .clear
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuLightRedColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeFourViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeFourViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeFourViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography", nil, nil),
17 | AnimatedDropdownMenu.Item.init("From | Artwork", nil, nil),
18 | AnimatedDropdownMenu.Item.init("Others", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuGreenColor()
54 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
55 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
56 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
57 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellTextAlignment = .left
59 | dropdownMenu.cellSeparatorColor = .clear
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuGreenColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeOneViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeOneViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeOneViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography",
17 | UIImage(named: "icon_photography")!,
18 | UIImage(named: "icon_photography_light")!
19 | ),
20 | AnimatedDropdownMenu.Item.init("From | Artwork",
21 | UIImage(named: "icon_artwork")!,
22 | UIImage(named: "icon_artwork_light")!
23 | ),
24 | AnimatedDropdownMenu.Item.init("Others",
25 | UIImage(named: "icon_other")!,
26 | UIImage(named: "icon_other_light")!
27 | )
28 | ]
29 |
30 | fileprivate var selectedStageIndex: Int = 0
31 | fileprivate var lastStageIndex: Int = 0
32 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
33 |
34 | // MARK: - Life Cycle
35 |
36 | override func viewDidLoad() {
37 |
38 | super.viewDidLoad()
39 | setupAnimatedDropdownMenu()
40 |
41 | view.backgroundColor = .white
42 | }
43 |
44 | override func viewWillAppear(_ animated: Bool) {
45 |
46 | super.viewWillAppear(animated)
47 | resetNavigationBarColor()
48 | }
49 |
50 | override func viewDidAppear(_ animated: Bool) {
51 |
52 | super.viewDidAppear(animated)
53 | dropdownMenu.show()
54 | }
55 |
56 | // MARK: - Private Methods
57 |
58 | fileprivate func setupAnimatedDropdownMenu() {
59 |
60 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
61 |
62 | dropdownMenu.cellBackgroundColor = UIColor.menuGreenColor()
63 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
64 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
65 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
66 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
67 | dropdownMenu.cellTextAlignment = .left
68 | dropdownMenu.cellSeparatorColor = .clear
69 |
70 | dropdownMenu.didSelectItemAtIndexHandler = {
71 | [weak self] selectedIndex in
72 |
73 | guard let strongSelf = self else {
74 | return
75 | }
76 |
77 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
78 | strongSelf.selectedStageIndex = selectedIndex
79 |
80 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
81 | return
82 | }
83 |
84 | //Configure Selected Action
85 | strongSelf.selectedAction()
86 | }
87 |
88 | self.dropdownMenu = dropdownMenu
89 | navigationItem.titleView = dropdownMenu
90 | }
91 |
92 | private func selectedAction() {
93 | print("\(dropdownItems[selectedStageIndex].title)")
94 | }
95 |
96 | fileprivate func resetNavigationBarColor() {
97 |
98 | navigationController?.navigationBar.barStyle = .black
99 | navigationController?.navigationBar.barTintColor = UIColor.menuGreenColor()
100 |
101 | let textAttributes: [String: Any] = [
102 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
103 | NSFontAttributeName: UIFont.navigationBarTitleFont()
104 | ]
105 |
106 | navigationController?.navigationBar.titleTextAttributes = textAttributes
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeSixViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeSixViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeSixViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography", nil, nil),
17 | AnimatedDropdownMenu.Item.init("From | Artwork", nil, nil),
18 | AnimatedDropdownMenu.Item.init("Others", nil, nil)
19 | ]
20 |
21 | fileprivate var selectedStageIndex: Int = 0
22 | fileprivate var lastStageIndex: Int = 0
23 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
24 |
25 | // MARK: - Life Cycle
26 |
27 | override func viewDidLoad() {
28 |
29 | super.viewDidLoad()
30 | setupAnimatedDropdownMenu()
31 |
32 | view.backgroundColor = .white
33 | }
34 |
35 | override func viewWillAppear(_ animated: Bool) {
36 |
37 | super.viewWillAppear(animated)
38 | resetNavigationBarColor()
39 | }
40 |
41 | override func viewDidAppear(_ animated: Bool) {
42 |
43 | super.viewDidAppear(animated)
44 | dropdownMenu.show()
45 | }
46 |
47 | // MARK: - Private Methods
48 |
49 | fileprivate func setupAnimatedDropdownMenu() {
50 |
51 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
52 |
53 | dropdownMenu.cellBackgroundColor = UIColor.menuPurpleColor()
54 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
55 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
56 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
57 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
58 | dropdownMenu.cellSeparatorColor = UIColor.init(white: 1.0, alpha: 0.1)
59 | dropdownMenu.cellTextAlignment = .left
60 |
61 | dropdownMenu.didSelectItemAtIndexHandler = {
62 | [weak self] selectedIndex in
63 |
64 | guard let strongSelf = self else {
65 | return
66 | }
67 |
68 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
69 | strongSelf.selectedStageIndex = selectedIndex
70 |
71 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
72 | return
73 | }
74 |
75 | //Configure Selected Action
76 | strongSelf.selectedAction()
77 | }
78 |
79 | self.dropdownMenu = dropdownMenu
80 | navigationItem.titleView = dropdownMenu
81 | }
82 |
83 | private func selectedAction() {
84 | print("\(dropdownItems[selectedStageIndex].title)")
85 | }
86 |
87 | fileprivate func resetNavigationBarColor() {
88 |
89 | navigationController?.navigationBar.barStyle = .black
90 | navigationController?.navigationBar.barTintColor = UIColor.menuPurpleColor()
91 |
92 | let textAttributes: [String: Any] = [
93 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
94 | NSFontAttributeName: UIFont.navigationBarTitleFont()
95 | ]
96 |
97 | navigationController?.navigationBar.titleTextAttributes = textAttributes
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeTreeViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeTreeViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeTreeViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography",
17 | UIImage(named: "icon_photography")!,
18 | UIImage(named: "icon_photography_light")!
19 | ),
20 | AnimatedDropdownMenu.Item.init("From | Artwork",
21 | UIImage(named: "icon_artwork")!,
22 | UIImage(named: "icon_artwork_light")!
23 | ),
24 | AnimatedDropdownMenu.Item.init("Others",
25 | UIImage(named: "icon_other")!,
26 | UIImage(named: "icon_other_light")!
27 | )
28 | ]
29 |
30 | fileprivate var selectedStageIndex: Int = 0
31 | fileprivate var lastStageIndex: Int = 0
32 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
33 |
34 | // MARK: - Life Cycle
35 |
36 | override func viewDidLoad() {
37 |
38 | super.viewDidLoad()
39 | setupAnimatedDropdownMenu()
40 |
41 | view.backgroundColor = .white
42 | }
43 |
44 | override func viewWillAppear(_ animated: Bool) {
45 |
46 | super.viewWillAppear(animated)
47 | resetNavigationBarColor()
48 | }
49 |
50 | override func viewDidAppear(_ animated: Bool) {
51 |
52 | super.viewDidAppear(animated)
53 | dropdownMenu.show()
54 | }
55 |
56 | // MARK: - Private Methods
57 |
58 | fileprivate func setupAnimatedDropdownMenu() {
59 |
60 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
61 |
62 | dropdownMenu.cellBackgroundColor = UIColor.menuPurpleColor()
63 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
64 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
65 | dropdownMenu.cellTextColor = UIColor.init(white: 1.0, alpha: 0.3)
66 | dropdownMenu.cellTextSelectedColor = UIColor.menuLightTextColor()
67 | dropdownMenu.cellSeparatorColor = UIColor.init(white: 1.0, alpha: 0.1)
68 | dropdownMenu.cellTextAlignment = .left
69 |
70 | dropdownMenu.didSelectItemAtIndexHandler = {
71 | [weak self] selectedIndex in
72 |
73 | guard let strongSelf = self else {
74 | return
75 | }
76 |
77 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
78 | strongSelf.selectedStageIndex = selectedIndex
79 |
80 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
81 | return
82 | }
83 |
84 | //Configure Selected Action
85 | strongSelf.selectedAction()
86 | }
87 |
88 | self.dropdownMenu = dropdownMenu
89 | navigationItem.titleView = dropdownMenu
90 | }
91 |
92 | private func selectedAction() {
93 | print("\(dropdownItems[selectedStageIndex].title)")
94 | }
95 |
96 | fileprivate func resetNavigationBarColor() {
97 |
98 | navigationController?.navigationBar.barStyle = .black
99 | navigationController?.navigationBar.barTintColor = UIColor.menuPurpleColor()
100 |
101 | let textAttributes: [String: Any] = [
102 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
103 | NSFontAttributeName: UIFont.navigationBarTitleFont()
104 | ]
105 |
106 | navigationController?.navigationBar.titleTextAttributes = textAttributes
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/Examples/Examples/MenuTypes/LeftTypeTwoViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LeftTypeTwoViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import AnimatedDropdownMenu
11 |
12 | class LeftTypeTwoViewController: UIViewController {
13 |
14 | // MARK: - Properties
15 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
16 | AnimatedDropdownMenu.Item.init("From | Photography",
17 | UIImage(named: "icon_photography_light")!,
18 | UIImage(named: "icon_photography_light")!
19 | ),
20 | AnimatedDropdownMenu.Item.init("From | Artwork",
21 | UIImage(named: "icon_artwork_light")!,
22 | UIImage(named: "icon_artwork_light")!
23 | ),
24 | AnimatedDropdownMenu.Item.init("Others",
25 | UIImage(named: "icon_other_light")!,
26 | UIImage(named: "icon_other_light")!
27 | )
28 | ]
29 |
30 | fileprivate var selectedStageIndex: Int = 0
31 | fileprivate var lastStageIndex: Int = 0
32 | fileprivate var dropdownMenu: AnimatedDropdownMenu!
33 |
34 | // MARK: - Life Cycle
35 |
36 | override func viewDidLoad() {
37 |
38 | super.viewDidLoad()
39 | setupAnimatedDropdownMenu()
40 |
41 | view.backgroundColor = .white
42 | }
43 |
44 | override func viewWillAppear(_ animated: Bool) {
45 |
46 | super.viewWillAppear(animated)
47 | resetNavigationBarColor()
48 | }
49 |
50 | override func viewDidAppear(_ animated: Bool) {
51 |
52 | super.viewDidAppear(animated)
53 | dropdownMenu.show()
54 | }
55 |
56 | // MARK: - Private Methods
57 |
58 | fileprivate func setupAnimatedDropdownMenu() {
59 |
60 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
61 |
62 | dropdownMenu.cellBackgroundColor = UIColor.menuLightRedColor()
63 | dropdownMenu.cellSelectedColor = UIColor.menuDarkRedColor()
64 | dropdownMenu.menuTitleColor = UIColor.menuLightTextColor()
65 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
66 | dropdownMenu.menuArrowTintColor = UIColor.menuLightTextColor()
67 | dropdownMenu.cellTextColor = UIColor.menuLightTextColor()
68 | dropdownMenu.cellTextAlignment = .left
69 | dropdownMenu.cellSeparatorColor = .clear
70 |
71 | dropdownMenu.didSelectItemAtIndexHandler = {
72 | [weak self] selectedIndex in
73 |
74 | guard let strongSelf = self else {
75 | return
76 | }
77 |
78 | strongSelf.lastStageIndex = strongSelf.selectedStageIndex
79 | strongSelf.selectedStageIndex = selectedIndex
80 |
81 | guard strongSelf.selectedStageIndex != strongSelf.lastStageIndex else {
82 | return
83 | }
84 |
85 | //Configure Selected Action
86 | strongSelf.selectedAction()
87 | }
88 |
89 | self.dropdownMenu = dropdownMenu
90 | navigationItem.titleView = dropdownMenu
91 | }
92 |
93 | private func selectedAction() {
94 | print("\(dropdownItems[selectedStageIndex].title)")
95 | }
96 |
97 | fileprivate func resetNavigationBarColor() {
98 |
99 | navigationController?.navigationBar.barStyle = .black
100 | navigationController?.navigationBar.barTintColor = UIColor.menuLightRedColor()
101 |
102 | let textAttributes: [String: Any] = [
103 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
104 | NSFontAttributeName: UIFont.navigationBarTitleFont()
105 | ]
106 |
107 | navigationController?.navigationBar.titleTextAttributes = textAttributes
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/Examples/Examples/MenusList/MenusListConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MenusListConfig.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/3.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class MenusListConfig: NSObject {
12 |
13 | struct MenusListCellConfig {
14 | let menuTitle: String
15 | let name: String
16 | let description: String
17 | let color: UIColor!
18 | }
19 |
20 | public class var MenusListCells: [MenusListCellConfig]{
21 | return [
22 | MenusListCellConfig(
23 | menuTitle: "DropdownMenu Type 01",
24 | name: "LEFT TYPE 01",
25 | description: "Icon & TextColor",
26 | color: UIColor.menuGreenColor()
27 | ),
28 | MenusListCellConfig(
29 | menuTitle: "DropdownMenu Type 02",
30 | name: "LEFT TYPE 02",
31 | description: "Icon & CellSelectedColor",
32 | color: UIColor.menuLightRedColor()
33 | ),
34 | MenusListCellConfig(
35 | menuTitle: "DropdownMenu Type 03",
36 | name: "LEFT TYPE 03",
37 | description: "Icon & TextColor & Separator",
38 | color: UIColor.menuPurpleColor()
39 | ),
40 | MenusListCellConfig(
41 | menuTitle: "DropdownMenu Type 04",
42 | name: "LEFT TYPE 04",
43 | description: "TextColor",
44 | color: UIColor.menuGreenColor()
45 | ),
46 | MenusListCellConfig(
47 | menuTitle: "DropdownMenu Type 05",
48 | name: "LEFT TYPE 05",
49 | description: "CellSelectedColor",
50 | color: UIColor.menuLightRedColor()
51 | ),
52 | MenusListCellConfig(
53 | menuTitle: "DropdownMenu Type 06",
54 | name: "LEFT TYPE 06",
55 | description: "TextColor & Separator",
56 | color: UIColor.menuPurpleColor()
57 | ),
58 | MenusListCellConfig(
59 | menuTitle: "DropdownMenu Type 07",
60 | name: "CENTER TYPE 01",
61 | description: "TextColor",
62 | color: UIColor.menuGreenColor()
63 | ),
64 | MenusListCellConfig(
65 | menuTitle: "DropdownMenu Type 08",
66 | name: "CENTER TYPE 02",
67 | description: "CellSelectedColor",
68 | color: UIColor.menuLightRedColor()
69 | ),
70 | MenusListCellConfig(
71 | menuTitle: "DropdownMenu Type 09",
72 | name: "CENTER TYPE 03",
73 | description: "Separator",
74 | color: UIColor.menuPurpleColor()
75 | ),
76 | ]
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Examples/Examples/MenusList/MenusListTableViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MenusListTableViewCell.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/2.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class MenusListTableViewCell: UITableViewCell {
12 |
13 | public class var reuseIdentifier: String {
14 | return "\(self)"
15 | }
16 |
17 | public class var requireCellHeight: CGFloat {
18 | let screenWidth = UIScreen.main.bounds.width
19 | return screenWidth / 375.0 * 184.0
20 | }
21 |
22 | override func awakeFromNib() {
23 | super.awakeFromNib()
24 | }
25 |
26 | @IBOutlet weak var menuTypeView: UIView!
27 | @IBOutlet weak var menuTitleLabel: UILabel!
28 | @IBOutlet weak var nameLabel: UILabel!
29 | @IBOutlet weak var descriptionLabel: UILabel!
30 |
31 | @IBAction func previewButtonClicked(_ sender: Any) {
32 | //TODO: Delegate
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Examples/Examples/MenusList/MenusListTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/Examples/Examples/MenusList/MenusListViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MenusListViewController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/2.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class MenusListViewController: UIViewController {
12 |
13 | @IBOutlet weak var tableView: UITableView!
14 |
15 | // MARK: - Life Cycle
16 | override func viewDidLoad() {
17 |
18 | super.viewDidLoad()
19 | setupTableView()
20 |
21 | title = "DropdownMenus"
22 | }
23 |
24 | override func viewWillAppear(_ animated: Bool) {
25 |
26 | super.viewWillAppear(animated)
27 | resetNavigationBarColor()
28 | }
29 |
30 | // MARK: - Private Methods
31 | fileprivate func resetNavigationBarColor() {
32 |
33 | navigationController?.navigationBar.barStyle = .default
34 | navigationController?.navigationBar.barTintColor = .white
35 |
36 | let textAttributes: [String: Any] = [
37 | NSForegroundColorAttributeName: UIColor.menuDarkGrayColor(),
38 | NSFontAttributeName: UIFont.navigationBarTitleFont()
39 | ]
40 |
41 | navigationController?.navigationBar.titleTextAttributes = textAttributes
42 | }
43 |
44 | fileprivate func setupTableView() {
45 | tableView.backgroundColor = UIColor(red: 242/255.0, green: 242/255.0, blue: 242/255.0, alpha: 1.0)
46 | tableView.register(UINib(nibName: MenusListTableViewCell.reuseIdentifier, bundle: nil), forCellReuseIdentifier: MenusListTableViewCell.reuseIdentifier)
47 | }
48 |
49 | }
50 |
51 | extension MenusListViewController: UITableViewDataSource {
52 |
53 | func numberOfSections(in tableView: UITableView) -> Int {
54 | return 1
55 | }
56 |
57 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
58 | return MenusListConfig.MenusListCells.count
59 | }
60 |
61 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
62 |
63 | let cellConfig = MenusListConfig.MenusListCells[indexPath.row]
64 | let cell = tableView.dequeueReusableCell(withIdentifier: MenusListTableViewCell.reuseIdentifier) as! MenusListTableViewCell
65 |
66 | cell.menuTitleLabel.text = cellConfig.menuTitle
67 | cell.nameLabel.text = cellConfig.name
68 | cell.descriptionLabel.text = cellConfig.description
69 | cell.menuTypeView.backgroundColor = cellConfig.color
70 |
71 | return cell
72 | }
73 | }
74 |
75 | extension MenusListViewController: UITableViewDelegate {
76 |
77 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
78 | return MenusListTableViewCell.requireCellHeight
79 | }
80 |
81 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
82 |
83 | var vc = UIViewController()
84 |
85 | if indexPath.row == 0 {
86 | vc = LeftTypeOneViewController()
87 | }
88 | else if indexPath.row == 1 {
89 | vc = LeftTypeTwoViewController()
90 | }
91 | else if indexPath.row == 2 {
92 | vc = LeftTypeTreeViewController()
93 | }
94 | else if indexPath.row == 3 {
95 | vc = LeftTypeFourViewController()
96 | }
97 | else if indexPath.row == 4 {
98 | vc = LeftTypeFiveViewController()
99 | }
100 | else if indexPath.row == 5 {
101 | vc = LeftTypeSixViewController()
102 | }
103 | else if indexPath.row == 6 {
104 | vc = CenterTypeOneViewController()
105 | }
106 | else if indexPath.row == 7 {
107 | vc = CenterTypeTwoViewController()
108 | }
109 | else if indexPath.row == 8 {
110 | vc = CenterTypeThreeViewController()
111 | }
112 |
113 | navigationController?.pushViewController(vc, animated: true)
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Examples/Examples/Navigation/DropdownMenuNavigationController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuNavigationController.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/1.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DropdownMenuNavigationController: UINavigationController {
12 |
13 | override func viewDidLoad() {
14 |
15 | super.viewDidLoad()
16 | configNavigationBar()
17 | }
18 |
19 | private func configNavigationBar() {
20 | navigationBar.backgroundColor = nil
21 | navigationBar.isTranslucent = true
22 | navigationBar.shadowImage = nil
23 | navigationBar.barStyle = .black
24 | navigationBar.setBackgroundImage(nil, for: .default)
25 |
26 | let textAttributes: [String: Any] = [
27 | NSForegroundColorAttributeName: UIColor.menuLightTextColor(),
28 | NSFontAttributeName: UIFont.navigationBarTitleFont()
29 | ]
30 |
31 | navigationBar.titleTextAttributes = textAttributes
32 | navigationBar.tintColor = UIColor.menuLightTextColor()
33 |
34 | navigationBar.barTintColor = UIColor.menuLightTextColor()
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Examples/Podfile:
--------------------------------------------------------------------------------
1 | source "https://github.com/CocoaPods/Specs.git"
2 | platform :ios, '9.0'
3 |
4 | target 'Examples' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | # Pods for Examples
9 | pod 'AnimatedDropdownMenu'
10 |
11 | end
12 |
--------------------------------------------------------------------------------
/Examples/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AnimatedDropdownMenu (0.3.3)
3 |
4 | DEPENDENCIES:
5 | - AnimatedDropdownMenu
6 |
7 | SPEC CHECKSUMS:
8 | AnimatedDropdownMenu: 64460794ca55b0672fced8720c51c405e2b6f5a7
9 |
10 | PODFILE CHECKSUM: f3a48800b94d8c2b8e6d84ae7bc6140f3718fdeb
11 |
12 | COCOAPODS: 1.1.1
13 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Jony Fang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | **AnimatedDropdownMenu** is a clean interface dropdown menu, appears underneath navigation bar to display a list of related items when you click on the navigation title.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Type 01
20 | Type 02
21 | Type 03
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Type 04
30 | Type 05
31 | Type 06
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | Type 07
40 | Type 08
41 | Type 09
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | ## Requirements
52 |
53 | - Xcode 8.0+
54 | - iOS 8.0+
55 | - Swift 3.0
56 |
57 | ## Example
58 |
59 | To run the example project, clone the repo, and start `Examples` in Xcode.
60 |
61 | ```ruby
62 | git clone https://github.com/JonyFang/AnimatedDropdownMenu
63 | cd AnimatedDropdownMenu/Examples
64 | pod install --no-repo-update
65 | open Examples.xcworkspace
66 | ```
67 |
68 | ## Installation
69 |
70 | ### CocoaPods
71 |
72 | To integrate AnimatedDropdownMenu into your Xcode project using CocoaPods, specify it in your `Podfile`:
73 |
74 | ```ruby
75 | pod 'AnimatedDropdownMenu'
76 | ```
77 |
78 | ## Usage
79 |
80 | ### Get Started
81 |
82 | Import the library where you want to use it.
83 |
84 | ```swift
85 | import AnimatedDropdownMenu
86 |
87 | class ExampleViewController: UIViewController {
88 | // MARK: - Properties
89 | fileprivate var selectedStageIndex: Int = 0
90 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
91 | AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
92 | AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
93 | AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
94 | ]
95 |
96 | // MARK: Life Cycle
97 | override func viewDidLoad() {
98 | super.viewDidLoad()
99 |
100 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
101 | dropdownMenu.didSelectItemAtIndexHandler = {
102 | [weak self] selectedIndex in
103 | guard let strongSelf = self else {
104 | return
105 | }
106 | strongSelf.selectedStageIndex = selectedIndex
107 | //Configure Selected Action
108 | }
109 |
110 | navigationItem.titleView = dropdownMenu
111 | }
112 | }
113 | ```
114 |
115 | ### Customization
116 |
117 | Once you have setup the dropdown menu, you can custom the interface of menu. You can override these properties for your favor:
118 |
119 | - `menuTitleColor`: **The font of the navigation bar title.** Default is `UIFont.systemFont(ofSize: 16.0)`
120 | - `menuArrowTintColor`: **The tint color of the arrow.** Default is `.darkGray`
121 | - `cellBackgroundColor`: **The color of the cell background.** Default is `RGBA(216, 85, 96, 1)`
122 | - `cellSelectedColor`: **The color of the cell when the cell is selected.** Default is `.clear`
123 | - `cellSeparatorColor`: **The color of the cell separator.** Default is `RGBA(255, 255, 255, 0.3)`
124 | - `cellTextColor`: **The color of the text inside cell.** Default is `RGBA(255, 255, 255, 0.3)`
125 | - `cellTextSelectedColor`: **The color of the text inside cell when the cell is selected.** Default is `.white`
126 | - `cellTextAlignment`: **The alignment of the text inside cell.** Default is `.center`
127 |
128 | ## Author
129 |
130 | - [Weibo: @JonyFang](http://weibo.com/3034766044/profile?topnav=1&wvr=6)
131 | - [Twitter: @JonyFang](https://twitter.com/jony_chunfang)
132 | - [Email: jony.chunfang@gmail.com](mailto:jony.chunfang@gmail.com)
133 |
134 | ## Contributing
135 |
136 | Please open a [new Issue here](https://github.com/JonyFang/AnimatedDropdownMenu/issues/new) if you run into a problem specific to **AnimatedDropdownMenu**, have a feature request, or want to share a comment.
137 |
138 | ## License
139 |
140 | **AnimatedDropdownMenu** is available under the MIT license. See the LICENSE file for more info.
141 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow.png
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@2x.png
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@3x.png
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/AnimatedDropdownMenu.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnimatedDropdownMenu.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/27.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class AnimatedDropdownMenu: UIView {
12 |
13 | public struct Item {
14 | public let title: String
15 | public let icon: UIImage?
16 | public let iconLight: UIImage?
17 |
18 | public init(_ title: String, _ icon: UIImage?, _ iconLight: UIImage?) {
19 | self.title = title
20 | self.icon = icon
21 | self.iconLight = iconLight
22 | }
23 | }
24 |
25 | public var didSelectItemAtIndexHandler: ((_ indexPath: Int) -> ())?
26 | public var isShown: Bool! = false
27 |
28 | public var menuTitleColor: UIColor! {
29 | get {
30 | return dropdownConfig.menuTitleColor
31 | }
32 | set(value) {
33 | dropdownConfig.menuTitleColor = value
34 | }
35 | }
36 |
37 | public var menuArrowTintColor: UIColor! {
38 | get {
39 | return dropdownConfig.arrowTintColor
40 | }
41 | set(value) {
42 | dropdownConfig.arrowTintColor = value
43 | menuArrow.tintColor = dropdownConfig.arrowTintColor
44 | }
45 | }
46 |
47 | public var cellBackgroundColor: UIColor! {
48 | get {
49 | return dropdownConfig.cellBackgroundColor
50 | }
51 | set(value) {
52 | dropdownConfig.cellBackgroundColor = value
53 | }
54 | }
55 |
56 | public var cellSelectedColor: UIColor! {
57 | get{
58 | return dropdownConfig.cellSelectedColor
59 | }
60 | set(value) {
61 | dropdownConfig.cellSelectedColor = value
62 | }
63 | }
64 |
65 | public var cellSeparatorColor: UIColor! {
66 | get {
67 | return dropdownConfig.cellSeparatorColor
68 | }
69 | set(value) {
70 | dropdownConfig.cellSeparatorColor = value
71 | }
72 | }
73 |
74 | public var cellTextColor: UIColor! {
75 | get {
76 | return dropdownConfig.cellTextLabelColor
77 | }
78 | set(value) {
79 | dropdownConfig.cellTextLabelColor = value
80 | }
81 | }
82 |
83 | public var cellTextSelectedColor: UIColor! {
84 | get {
85 | return dropdownConfig.cellTextLabelSelectedColor
86 | }
87 | set(value) {
88 | dropdownConfig.cellTextLabelSelectedColor = value
89 | }
90 | }
91 |
92 | public var cellTextAlignment: NSTextAlignment! {
93 | get {
94 | return dropdownConfig.cellTextLabelAlignment
95 | }
96 | set(value) {
97 | dropdownConfig.cellTextLabelAlignment = value
98 | }
99 | }
100 |
101 | fileprivate weak var navigationController: UINavigationController?
102 | fileprivate var menuButton: UIButton!
103 | fileprivate var menuTitleLabel: UILabel!
104 | fileprivate var menuArrow: UIImageView!
105 | fileprivate var menuWrapper: UIView!
106 | fileprivate var backgroundView: UIView!
107 | fileprivate var tableView: DropdownMenuTableView!
108 |
109 | fileprivate var items:[Item]!
110 | fileprivate var dropdownConfig = DropdownMenuConfig()
111 |
112 | required public init?(coder aDecoder: NSCoder) {
113 | fatalError("init(coder:) has not been implemented")
114 | }
115 |
116 | // MARK: - Public Methods
117 |
118 | public func show() {
119 | if isShown == false {
120 | showMenu()
121 | }
122 | }
123 |
124 | public func dismiss() {
125 | if isShown == true {
126 | hideMenu()
127 | }
128 | }
129 |
130 | public init(navigationController: UINavigationController!, containerView: UIView!, selectedIndex: Int!, items: [Item]!) {
131 | guard let window = UIApplication.shared.keyWindow else {
132 | super.init(frame: .zero)
133 | return
134 | }
135 |
136 | //Navigation Controller
137 | if let navigationController = navigationController {
138 | self.navigationController = navigationController
139 | }
140 | else {
141 | self.navigationController = window.rootViewController?.topViewController?.navigationController
142 | }
143 |
144 | let title = items[selectedIndex].title
145 |
146 | //Get titleSize
147 | let titleSize = (title as NSString).size(attributes: [NSFontAttributeName: dropdownConfig.menuTitleFont])
148 |
149 | //Init frame
150 | let frame = CGRect(x: 0, y: 0, width: titleSize.width + dropdownConfig.arrowPadding + dropdownConfig.arrowImage.size.width * 2, height: navigationController.navigationBar.frame.height)
151 |
152 | super.init(frame: frame)
153 |
154 |
155 | self.isShown = false
156 | self.items = items
157 |
158 |
159 | //Setup Navigation Menu
160 | menuButton = UIButton(frame: frame)
161 | menuButton.addTarget(self, action: #selector(self.menuButtonTapped(_:)), for: .touchUpInside)
162 |
163 | menuTitleLabel = UILabel(frame: frame)
164 | menuTitleLabel.text = title
165 | menuTitleLabel.textColor = dropdownConfig.menuTitleColor
166 | menuTitleLabel.font = dropdownConfig.menuTitleFont
167 | menuTitleLabel.textAlignment = dropdownConfig.cellTextLabelAlignment
168 |
169 | menuArrow = UIImageView(image: dropdownConfig.arrowImage.withRenderingMode(.alwaysTemplate))
170 | menuArrow.tintColor = dropdownConfig.arrowTintColor
171 |
172 | addSubview(menuButton)
173 | menuButton.addSubview(menuTitleLabel)
174 | menuButton.addSubview(menuArrow)
175 |
176 |
177 | let menuWrapperBounds = window.bounds
178 |
179 | //Setup DropdownMenu
180 | menuWrapper = UIView(frame: menuWrapperBounds)
181 | menuWrapper.clipsToBounds = true
182 |
183 | //Setup BackgroundView
184 | backgroundView = UIView(frame: menuWrapperBounds)
185 | backgroundView.backgroundColor = dropdownConfig.maskBuckgroundColor
186 |
187 | let backgroundTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(AnimatedDropdownMenu.hideMenu))
188 | backgroundView.addGestureRecognizer(backgroundTapRecognizer)
189 |
190 | //Setup Default Configuratin
191 | //setupDefaultConfiguration()
192 |
193 | //Setup TableView
194 | tableView = DropdownMenuTableView(frame: CGRect(x: menuWrapperBounds.origin.x, y: -300.0, width: menuWrapperBounds.width, height: 300.0 + dropdownConfig.cellHeight * CGFloat(items.count)), items: items, selectedIndex: selectedIndex, config: dropdownConfig)
195 | tableView.layer.cornerRadius = 5.0
196 | tableView.layer.masksToBounds = true
197 | tableView.selectRowAtIndexPathHandler = {
198 | [weak self] selectedIndex in
199 | guard let strongSelf = self else {
200 | return
201 | }
202 |
203 | strongSelf.didSelectItemAtIndexHandler!(selectedIndex)
204 | strongSelf.menuTitleLabel.text = strongSelf.items[selectedIndex].title
205 |
206 | strongSelf.hideMenu()
207 | strongSelf.layoutSubviews()
208 | }
209 |
210 | menuWrapper.addSubview(backgroundView)
211 | menuWrapper.addSubview(tableView)
212 | containerView.addSubview(menuWrapper)
213 |
214 | menuWrapper.isHidden = true
215 | }
216 |
217 | // MARK: - Life Cycle
218 |
219 | override public func layoutSubviews() {
220 |
221 | menuTitleLabel.sizeToFit()
222 | menuTitleLabel.center = CGPoint(x: frame.size.width * 0.5, y: frame.size.height * 0.5)
223 | menuTitleLabel.textColor = dropdownConfig.menuTitleColor
224 |
225 | menuArrow.center = CGPoint(x: menuTitleLabel.frame.maxX + dropdownConfig.arrowPadding, y: frame.size.height * 0.5)
226 |
227 | menuWrapper.frame.origin.y = (navigationController?.navigationBar.frame.maxY)!
228 | tableView.reloadData()
229 | }
230 |
231 | // MARK: - Private Methods
232 |
233 | fileprivate func setupDefaultConfiguration() {
234 |
235 | menuTitleColor = navigationController?.navigationBar.titleTextAttributes?[NSForegroundColorAttributeName] as? UIColor
236 | cellBackgroundColor = navigationController?.navigationBar.barTintColor
237 | cellTextColor = menuTitleColor
238 | cellSeparatorColor = .clear
239 |
240 | menuArrowTintColor = menuTitleColor
241 | }
242 |
243 | @objc fileprivate func menuButtonTapped(_ sender: UIButton) {
244 | isShown == true ? hideMenu() : showMenu()
245 | }
246 |
247 | @objc fileprivate func hideMenu() {
248 | isShown = false
249 | menuButton.isUserInteractionEnabled = false
250 |
251 | //Rotate Arrow
252 | rotateArrowAnimation()
253 |
254 | //Wapper Animation
255 | backgroundView.alpha = dropdownConfig.maskBackgroundOpacity
256 |
257 | UIView.animate(withDuration: dropdownConfig.animationDuration,
258 | delay: 0,
259 | usingSpringWithDamping: 0.7,
260 | initialSpringVelocity: 0.5,
261 | options: UIViewAnimationOptions(),
262 | animations: {
263 | self.tableView.frame.origin.y = -CGFloat(self.items.count) * self.dropdownConfig.cellHeight - 300.0
264 | self.backgroundView.alpha = 0
265 | }) { finished in
266 | self.menuWrapper.isHidden = true
267 | self.menuButton.isUserInteractionEnabled = true
268 | }
269 | }
270 |
271 | fileprivate func showMenu() {
272 | isShown = true
273 | menuButton.isUserInteractionEnabled = false
274 |
275 | menuWrapper.frame.origin.y = (navigationController?.navigationBar.frame.maxY)!
276 |
277 | let tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: frame.width, height: 300))
278 | tableHeaderView.backgroundColor = dropdownConfig.cellBackgroundColor
279 | tableView.tableHeaderView = tableHeaderView
280 |
281 | //Rotate Arrow
282 | rotateArrowAnimation()
283 |
284 | //Wapper Animation
285 | menuWrapper.isHidden = false
286 | backgroundView.alpha = 0
287 |
288 | tableView.frame.origin.y = -CGFloat(items.count) * dropdownConfig.cellHeight - 300.0
289 | tableView.reloadData()
290 |
291 | menuWrapper.superview?.bringSubview(toFront: menuWrapper)
292 |
293 | UIView.animate(withDuration: dropdownConfig.animationDuration, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: UIViewAnimationOptions(), animations: {
294 | self.tableView.frame.origin.y = CGFloat(-300.0)
295 | self.backgroundView.alpha = self.dropdownConfig.maskBackgroundOpacity
296 | }) { finished in
297 | self.menuButton.isUserInteractionEnabled = true
298 | }
299 | }
300 |
301 | fileprivate func rotateArrowAnimation() {
302 | UIView.animate(withDuration: dropdownConfig.animationDuration) { [weak self] in
303 | guard let strongSelf = self else {
304 | return
305 | }
306 | strongSelf.menuArrow.transform = strongSelf.menuArrow.transform.rotated(by: 180 * CGFloat(M_PI/180))
307 | }
308 | }
309 |
310 | }
311 |
312 | extension UIViewController {
313 |
314 | //Get top visible ViewController in top present level
315 | fileprivate var topViewController: UIViewController? {
316 | return topPresentedViewController?.topVisibleViewController
317 | }
318 |
319 | //Get top presented ViewController
320 | private var topPresentedViewController: UIViewController? {
321 |
322 | var target: UIViewController? = self
323 | if target?.presentedViewController != nil {
324 | target = target?.presentedViewController
325 | }
326 |
327 | return target
328 | }
329 |
330 | //Get top visible ViewController
331 | private var topVisibleViewController: UIViewController? {
332 |
333 | if let navigation = self as? UINavigationController {
334 | if let visibleViewController = navigation.visibleViewController {
335 | return visibleViewController.topVisibleViewController
336 | }
337 | }
338 | if let tab = self as? UITabBarController {
339 | if let selectedViewController = tab.selectedViewController {
340 | return selectedViewController.topVisibleViewController
341 | }
342 | }
343 |
344 | return self
345 | }
346 |
347 | }
348 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/DropdownMenuCellSeparator.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuCellSeparator.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/2.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuCellSeparator: UIView {
12 |
13 | var separatorColor: UIColor {
14 | get {
15 | return self.backgroundColor!
16 | }
17 | set(value) {
18 | self.backgroundColor = value
19 | }
20 | }
21 |
22 | override init(frame: CGRect) {
23 | super.init(frame: frame)
24 | initialize()
25 | }
26 |
27 | required public init?(coder aDecoder: NSCoder) {
28 | super.init(coder: aDecoder)
29 | initialize()
30 | }
31 |
32 | func initialize() {
33 | backgroundColor = UIColor.clear
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/DropdownMenuConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuConfig.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/28.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuConfig {
12 |
13 | var menuTitleColor: UIColor?
14 | var menuTitleFont: UIFont!
15 |
16 | var cellHeight: CGFloat!
17 | var cellBackgroundColor: UIColor?
18 | var cellSelectedColor: UIColor?
19 | var cellSeparatorColor: UIColor?
20 | var cellTextLabelColor: UIColor?
21 | var cellTextLabelFont: UIFont!
22 | var cellTextLabelAlignment: NSTextAlignment!
23 | var cellTextLabelSelectedColor: UIColor?
24 | var cellIconImage: UIImage!
25 |
26 | var arrowTintColor: UIColor?
27 | var arrowPadding: CGFloat!
28 | var arrowImage: UIImage!
29 |
30 | var maskBuckgroundColor: UIColor!
31 | var maskBackgroundOpacity: CGFloat!
32 | var animationDuration: TimeInterval!
33 | var shouldChangeTitleText: Bool!
34 | var shouldKeepSelectedCellColor: Bool!
35 |
36 | init() {
37 | configDefaultValue()
38 | }
39 |
40 | fileprivate func configDefaultValue() {
41 | //Path for image
42 | let bundle = Bundle(for: DropdownMenuConfig.self)
43 | let bundleUrl = bundle.url(forResource: "AnimatedDropdownMenu", withExtension: "bundle")
44 | let imageBundle = Bundle(url: bundleUrl!)
45 | let arrowImagePath = imageBundle?.path(forResource: "icon_dropdown_arrow", ofType: "png")
46 |
47 | //Default values
48 | menuTitleColor = UIColor.darkGray
49 | menuTitleFont = UIFont.systemFont(ofSize: 16.0)
50 |
51 | cellHeight = 50.0
52 | cellBackgroundColor = UIColor(red: 216/255.0, green: 85/255.0, blue: 96/255.0, alpha: 1.0)
53 | cellSelectedColor = UIColor.clear
54 | cellSeparatorColor = UIColor.init(white: 1.0, alpha: 0.3)
55 | cellTextLabelColor = UIColor.init(white: 1.0, alpha: 0.3)
56 | cellTextLabelFont = UIFont.systemFont(ofSize: 15.0)
57 | cellTextLabelAlignment = .center
58 | cellTextLabelSelectedColor = UIColor.white
59 |
60 | arrowTintColor = UIColor.darkGray
61 | arrowPadding = 10.0
62 | arrowImage = UIImage(contentsOfFile: arrowImagePath!)
63 |
64 | maskBuckgroundColor = UIColor.black
65 | maskBackgroundOpacity = 0.5
66 | animationDuration = 0.25
67 | shouldChangeTitleText = true
68 | shouldKeepSelectedCellColor = true
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/DropdownMenuTableView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuTableView.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/27.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuTableView: UITableView {
12 |
13 | public var selectRowAtIndexPathHandler: ((_ indexPath: Int) -> ())?
14 |
15 | fileprivate var selectedIndex: Int?
16 | fileprivate var items: [AnimatedDropdownMenu.Item] = []
17 | fileprivate var dropdownMenuConfig: DropdownMenuConfig!
18 | fileprivate let kDropdownMenuTableViewCell = "DropdownMenuTableViewCell"
19 |
20 | required public init?(coder aDecoder: NSCoder) {
21 | fatalError("init(coder:) has not been implemented")
22 | }
23 |
24 | init(frame: CGRect, items: [AnimatedDropdownMenu.Item], selectedIndex: Int, config: DropdownMenuConfig) {
25 | super.init(frame: frame, style: .plain)
26 |
27 | self.items = items
28 | self.selectedIndex = selectedIndex
29 | self.dropdownMenuConfig = config
30 |
31 | delegate = self
32 | dataSource = self
33 | separatorStyle = .none
34 | backgroundColor = .clear
35 | autoresizingMask = .flexibleWidth
36 | isScrollEnabled = false
37 | }
38 | }
39 |
40 | extension DropdownMenuTableView: UITableViewDataSource {
41 |
42 | public func numberOfSections(in tableView: UITableView) -> Int {
43 | return 1
44 | }
45 |
46 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
47 | return items.count
48 | }
49 |
50 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
51 |
52 | let cell = DropdownMenuTableViewCell(style: .default, reuseIdentifier: kDropdownMenuTableViewCell, config: dropdownMenuConfig)
53 | cell.textLabel?.text = items[indexPath.row].title
54 |
55 | return cell
56 | }
57 | }
58 |
59 | extension DropdownMenuTableView: UITableViewDelegate {
60 |
61 | public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
62 | return dropdownMenuConfig.cellHeight
63 | }
64 |
65 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
66 |
67 | selectedIndex = indexPath.row
68 | selectRowAtIndexPathHandler!(indexPath.row)
69 | reloadData()
70 | }
71 |
72 | public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
73 |
74 | guard dropdownMenuConfig.shouldKeepSelectedCellColor! else {
75 | return
76 | }
77 |
78 | let tableCell = cell as! DropdownMenuTableViewCell
79 | let icon: UIImage? = items[indexPath.row].icon
80 | let iconLight: UIImage? = items[indexPath.row].iconLight
81 |
82 | if icon != nil && iconLight != nil {
83 | tableCell.iconImageView?.image = (indexPath.row == selectedIndex) ? iconLight : icon
84 | }
85 |
86 | if dropdownMenuConfig.cellSelectedColor != .clear {
87 | cell.contentView.backgroundColor = (indexPath.row == selectedIndex) ?
88 | dropdownMenuConfig.cellSelectedColor :
89 | dropdownMenuConfig.cellBackgroundColor
90 | }
91 |
92 | if dropdownMenuConfig.cellTextLabelSelectedColor != .clear {
93 | tableCell.textLabel?.textColor = (indexPath.row == selectedIndex) ?
94 | dropdownMenuConfig.cellTextLabelSelectedColor :
95 | dropdownMenuConfig.cellTextLabelColor
96 | }
97 |
98 | guard (dropdownMenuConfig.cellSeparatorColor != nil) else {
99 | return
100 | }
101 |
102 | if indexPath.row == items.count - 1 {
103 | tableCell.cellSeparator.separatorColor = .clear
104 | }
105 | else {
106 | tableCell.cellSeparator.separatorColor = dropdownMenuConfig.cellSeparatorColor!
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Examples/Pods/AnimatedDropdownMenu/Source/DropdownMenuTableViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuTableViewCell.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/28.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuTableViewCell: UITableViewCell {
12 |
13 | var iconImageView: UIImageView!
14 | var cellSeparator: DropdownMenuCellSeparator!
15 | var cellContentFrame: CGRect!
16 | var dropdownMenuConfig: DropdownMenuConfig!
17 |
18 | init(style: UITableViewCellStyle, reuseIdentifier: String?, config: DropdownMenuConfig) {
19 | super.init(style: style, reuseIdentifier: reuseIdentifier)
20 |
21 | dropdownMenuConfig = config
22 | cellContentFrame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: dropdownMenuConfig.cellHeight)
23 | contentView.backgroundColor = dropdownMenuConfig.cellBackgroundColor
24 | selectionStyle = .none
25 |
26 | textLabel?.textColor = dropdownMenuConfig.cellTextLabelColor
27 | textLabel?.font = dropdownMenuConfig.cellTextLabelFont
28 | textLabel!.textAlignment = dropdownMenuConfig.cellTextLabelAlignment
29 |
30 | iconImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 16.0, height: 16.0))
31 | iconImageView.image = dropdownMenuConfig.cellIconImage
32 | iconImageView.contentMode = .scaleAspectFill
33 | contentView.addSubview(iconImageView)
34 |
35 | switch textLabel!.textAlignment {
36 | case .left:
37 | textLabel?.frame = CGRect(x: 42, y: 0, width: cellContentFrame.width - 42, height: cellContentFrame.height)
38 | iconImageView.frame = CGRect(x: 16, y: (textLabel?.center.y)! - 8, width: 16, height: 16)
39 | break
40 | case .center:
41 | textLabel?.frame = cellContentFrame
42 | iconImageView.frame = .zero
43 | default:
44 | break
45 | }
46 |
47 | //Add Separator for Cell
48 | cellSeparator = DropdownMenuCellSeparator(frame: CGRect(x: 0, y: cellContentFrame.height, width: cellContentFrame.width, height: 1))
49 | if let cellSeparatorColor = dropdownMenuConfig.cellSeparatorColor {
50 | cellSeparator.separatorColor = cellSeparatorColor
51 | }
52 | contentView.addSubview(cellSeparator)
53 | }
54 |
55 | required public init?(coder aDecoder: NSCoder) {
56 | fatalError("init(coder:) has not been implemented")
57 | }
58 |
59 | override public func layoutSubviews() {
60 | bounds = cellContentFrame
61 | contentView.frame = bounds
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Examples/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AnimatedDropdownMenu (0.3.3)
3 |
4 | DEPENDENCIES:
5 | - AnimatedDropdownMenu
6 |
7 | SPEC CHECKSUMS:
8 | AnimatedDropdownMenu: 64460794ca55b0672fced8720c51c405e2b6f5a7
9 |
10 | PODFILE CHECKSUM: f3a48800b94d8c2b8e6d84ae7bc6140f3718fdeb
11 |
12 | COCOAPODS: 1.1.1
13 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/AnimatedDropdownMenu-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_AnimatedDropdownMenu : NSObject
3 | @end
4 | @implementation PodsDummy_AnimatedDropdownMenu
5 | @end
6 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/AnimatedDropdownMenu-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/AnimatedDropdownMenu-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double AnimatedDropdownMenuVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char AnimatedDropdownMenuVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/AnimatedDropdownMenu.modulemap:
--------------------------------------------------------------------------------
1 | framework module AnimatedDropdownMenu {
2 | umbrella header "AnimatedDropdownMenu-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/AnimatedDropdownMenu.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/AnimatedDropdownMenu
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/AnimatedDropdownMenu/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.3.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## AnimatedDropdownMenu
5 |
6 | MIT License
7 |
8 | Copyright (c) 2017 Jony Fang
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all
18 | copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 | SOFTWARE.
27 |
28 | Generated by CocoaPods - https://cocoapods.org
29 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | MIT License
18 |
19 | Copyright (c) 2017 Jony Fang
20 |
21 | Permission is hereby granted, free of charge, to any person obtaining a copy
22 | of this software and associated documentation files (the "Software"), to deal
23 | in the Software without restriction, including without limitation the rights
24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25 | copies of the Software, and to permit persons to whom the Software is
26 | furnished to do so, subject to the following conditions:
27 |
28 | The above copyright notice and this permission notice shall be included in all
29 | copies or substantial portions of the Software.
30 |
31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37 | SOFTWARE.
38 |
39 | License
40 | MIT
41 | Title
42 | AnimatedDropdownMenu
43 | Type
44 | PSGroupSpecifier
45 |
46 |
47 | FooterText
48 | Generated by CocoaPods - https://cocoapods.org
49 | Title
50 |
51 | Type
52 | PSGroupSpecifier
53 |
54 |
55 | StringsTable
56 | Acknowledgements
57 | Title
58 | Acknowledgements
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Examples : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Examples
5 | @end
6 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
86 | if [[ "$CONFIGURATION" == "Debug" ]]; then
87 | install_framework "$BUILT_PRODUCTS_DIR/AnimatedDropdownMenu/AnimatedDropdownMenu.framework"
88 | fi
89 | if [[ "$CONFIGURATION" == "Release" ]]; then
90 | install_framework "$BUILT_PRODUCTS_DIR/AnimatedDropdownMenu/AnimatedDropdownMenu.framework"
91 | fi
92 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | *)
22 | TARGET_DEVICE_ARGS="--target-device mac"
23 | ;;
24 | esac
25 |
26 | install_resource()
27 | {
28 | if [[ "$1" = /* ]] ; then
29 | RESOURCE_PATH="$1"
30 | else
31 | RESOURCE_PATH="${PODS_ROOT}/$1"
32 | fi
33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
34 | cat << EOM
35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
36 | EOM
37 | exit 1
38 | fi
39 | case $RESOURCE_PATH in
40 | *.storyboard)
41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
43 | ;;
44 | *.xib)
45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
47 | ;;
48 | *.framework)
49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
53 | ;;
54 | *.xcdatamodel)
55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
57 | ;;
58 | *.xcdatamodeld)
59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
61 | ;;
62 | *.xcmappingmodel)
63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
65 | ;;
66 | *.xcassets)
67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
69 | ;;
70 | *)
71 | echo "$RESOURCE_PATH"
72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
73 | ;;
74 | esac
75 | }
76 |
77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
82 | fi
83 | rm -f "$RESOURCES_TO_COPY"
84 |
85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
86 | then
87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
89 | while read line; do
90 | if [[ $line != "${PODS_ROOT}*" ]]; then
91 | XCASSET_FILES+=("$line")
92 | fi
93 | done <<<"$OTHER_XCASSETS"
94 |
95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
96 | fi
97 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double Pods_ExamplesVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char Pods_ExamplesVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AnimatedDropdownMenu"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/AnimatedDropdownMenu/AnimatedDropdownMenu.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "AnimatedDropdownMenu"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Examples {
2 | umbrella header "Pods-Examples-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/Pods/Target Support Files/Pods-Examples/Pods-Examples.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AnimatedDropdownMenu"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/AnimatedDropdownMenu/AnimatedDropdownMenu.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "AnimatedDropdownMenu"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Jony Fang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | **AnimatedDropdownMenu** is a clean interface dropdown menu, appears underneath navigation bar to display a list of related items when you click on the navigation title.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Type 01
20 | Type 02
21 | Type 03
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Type 04
30 | Type 05
31 | Type 06
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | Type 07
40 | Type 08
41 | Type 09
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | ## Requirements
52 |
53 | - Xcode 8.0+
54 | - iOS 8.0+
55 | - Swift 3.0
56 |
57 | ## Example
58 |
59 | To run the example project, clone the repo, and start `Examples` in Xcode.
60 |
61 | ```ruby
62 | $ git clone https://github.com/JonyFang/AnimatedDropdownMenu
63 | $ cd AnimatedDropdownMenu/Examples
64 | $ open Examples.xcworkspace
65 | ```
66 |
67 | ## Installation
68 |
69 | ### CocoaPods
70 |
71 | To integrate AnimatedDropdownMenu into your Xcode project using CocoaPods, specify it in your `Podfile`:
72 |
73 | ```ruby
74 | pod 'AnimatedDropdownMenu'
75 | ```
76 |
77 | ## Usage
78 |
79 | ### Get Started
80 |
81 | Import the library where you want to use it.
82 |
83 | ```swift
84 | import AnimatedDropdownMenu
85 |
86 | class ExampleViewController: UIViewController {
87 | // MARK: - Properties
88 | fileprivate var selectedStageIndex: Int = 0
89 | fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
90 | AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
91 | AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
92 | AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
93 | ]
94 |
95 | // MARK: Life Cycle
96 | override func viewDidLoad() {
97 | super.viewDidLoad()
98 |
99 | let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
100 | dropdownMenu.didSelectItemAtIndexHandler = {
101 | [weak self] selectedIndex in
102 | guard let strongSelf = self else {
103 | return
104 | }
105 | strongSelf.selectedStageIndex = selectedIndex
106 | //Configure Selected Action
107 | }
108 |
109 | navigationItem.titleView = dropdownMenu
110 | }
111 | }
112 | ```
113 |
114 | ### Customization
115 |
116 | Once you have setup the dropdown menu, you can custom the interface of menu. You can override these properties for your favor:
117 |
118 | - `menuTitleColor`: **The font of the navigation bar title.** Default is `UIFont.systemFont(ofSize: 16.0)`
119 | - `menuArrowTintColor`: **The tint color of the arrow.** Default is `.darkGray`
120 | - `cellBackgroundColor`: **The color of the cell background.** Default is `RGBA(216, 85, 96, 1)`
121 | - `cellSelectedColor`: **The color of the cell when the cell is selected.** Default is `.clear`
122 | - `cellSeparatorColor`: **The color of the cell separator.** Default is `RGBA(255, 255, 255, 0.3)`
123 | - `cellTextColor`: **The color of the text inside cell.** Default is `RGBA(255, 255, 255, 0.3)`
124 | - `cellTextSelectedColor`: **The color of the text inside cell when the cell is selected.** Default is `.white`
125 | - `cellTextAlignment`: **The alignment of the text inside cell.** Default is `.center`
126 |
127 | ## Author
128 |
129 | - [Weibo: @JonyFang](http://weibo.com/3034766044/profile?topnav=1&wvr=6)
130 | - [Twitter: @JonyFang](https://twitter.com/jony_chunfang)
131 | - [Email: jony.chunfang@gmail.com](mailto:jony.chunfang@gmail.com)
132 |
133 | ## Contributing
134 |
135 | Please open a [new Issue here](https://github.com/JonyFang/AnimatedDropdownMenu/issues/new) if you run into a problem specific to **AnimatedDropdownMenu**, have a feature request, or want to share a comment.
136 |
137 | ## License
138 |
139 | **AnimatedDropdownMenu** is available under the MIT license. See the LICENSE file for more info.
140 |
--------------------------------------------------------------------------------
/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow.png
--------------------------------------------------------------------------------
/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@2x.png
--------------------------------------------------------------------------------
/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JonyFang/AnimatedDropdownMenu/058c67e8563f9a8727a12dba4f88670402eb4b06/Source/AnimatedDropdownMenu.bundle/icon_dropdown_arrow@3x.png
--------------------------------------------------------------------------------
/Source/AnimatedDropdownMenu.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnimatedDropdownMenu.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/27.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class AnimatedDropdownMenu: UIView {
12 |
13 | public struct Item {
14 | public let title: String
15 | public let icon: UIImage?
16 | public let iconLight: UIImage?
17 |
18 | public init(_ title: String, _ icon: UIImage?, _ iconLight: UIImage?) {
19 | self.title = title
20 | self.icon = icon
21 | self.iconLight = iconLight
22 | }
23 | }
24 |
25 | public var didSelectItemAtIndexHandler: ((_ indexPath: Int) -> ())?
26 | public var isShown: Bool! = false
27 |
28 | public var menuTitleColor: UIColor! {
29 | get {
30 | return dropdownConfig.menuTitleColor
31 | }
32 | set(value) {
33 | dropdownConfig.menuTitleColor = value
34 | }
35 | }
36 |
37 | public var menuArrowTintColor: UIColor! {
38 | get {
39 | return dropdownConfig.arrowTintColor
40 | }
41 | set(value) {
42 | dropdownConfig.arrowTintColor = value
43 | menuArrow.tintColor = dropdownConfig.arrowTintColor
44 | }
45 | }
46 |
47 | public var cellBackgroundColor: UIColor! {
48 | get {
49 | return dropdownConfig.cellBackgroundColor
50 | }
51 | set(value) {
52 | dropdownConfig.cellBackgroundColor = value
53 | }
54 | }
55 |
56 | public var cellSelectedColor: UIColor! {
57 | get{
58 | return dropdownConfig.cellSelectedColor
59 | }
60 | set(value) {
61 | dropdownConfig.cellSelectedColor = value
62 | }
63 | }
64 |
65 | public var cellSeparatorColor: UIColor! {
66 | get {
67 | return dropdownConfig.cellSeparatorColor
68 | }
69 | set(value) {
70 | dropdownConfig.cellSeparatorColor = value
71 | }
72 | }
73 |
74 | public var cellTextColor: UIColor! {
75 | get {
76 | return dropdownConfig.cellTextLabelColor
77 | }
78 | set(value) {
79 | dropdownConfig.cellTextLabelColor = value
80 | }
81 | }
82 |
83 | public var cellTextSelectedColor: UIColor! {
84 | get {
85 | return dropdownConfig.cellTextLabelSelectedColor
86 | }
87 | set(value) {
88 | dropdownConfig.cellTextLabelSelectedColor = value
89 | }
90 | }
91 |
92 | public var cellTextAlignment: NSTextAlignment! {
93 | get {
94 | return dropdownConfig.cellTextLabelAlignment
95 | }
96 | set(value) {
97 | dropdownConfig.cellTextLabelAlignment = value
98 | }
99 | }
100 |
101 | fileprivate weak var navigationController: UINavigationController?
102 | fileprivate var menuButton: UIButton!
103 | fileprivate var menuTitleLabel: UILabel!
104 | fileprivate var menuArrow: UIImageView!
105 | fileprivate var menuWrapper: UIView!
106 | fileprivate var backgroundView: UIView!
107 | fileprivate var tableView: DropdownMenuTableView!
108 |
109 | fileprivate var items:[Item]!
110 | fileprivate var dropdownConfig = DropdownMenuConfig()
111 |
112 | required public init?(coder aDecoder: NSCoder) {
113 | fatalError("init(coder:) has not been implemented")
114 | }
115 |
116 | // MARK: - Public Methods
117 |
118 | public func show() {
119 | if isShown == false {
120 | showMenu()
121 | }
122 | }
123 |
124 | public func dismiss() {
125 | if isShown == true {
126 | hideMenu()
127 | }
128 | }
129 |
130 | public init(navigationController: UINavigationController!, containerView: UIView!, selectedIndex: Int!, items: [Item]!) {
131 | guard let window = UIApplication.shared.keyWindow else {
132 | super.init(frame: .zero)
133 | return
134 | }
135 |
136 | //Navigation Controller
137 | if let navigationController = navigationController {
138 | self.navigationController = navigationController
139 | }
140 | else {
141 | self.navigationController = window.rootViewController?.topViewController?.navigationController
142 | }
143 |
144 | let title = items[selectedIndex].title
145 |
146 | //Get titleSize
147 | let titleSize = (title as NSString).size(attributes: [NSFontAttributeName: dropdownConfig.menuTitleFont])
148 |
149 | //Init frame
150 | let frame = CGRect(x: 0, y: 0, width: titleSize.width + dropdownConfig.arrowPadding + dropdownConfig.arrowImage.size.width * 2, height: navigationController.navigationBar.frame.height)
151 |
152 | super.init(frame: frame)
153 |
154 |
155 | self.isShown = false
156 | self.items = items
157 |
158 |
159 | //Setup Navigation Menu
160 | menuButton = UIButton(frame: frame)
161 | menuButton.addTarget(self, action: #selector(self.menuButtonTapped(_:)), for: .touchUpInside)
162 |
163 | menuTitleLabel = UILabel(frame: frame)
164 | menuTitleLabel.text = title
165 | menuTitleLabel.textColor = dropdownConfig.menuTitleColor
166 | menuTitleLabel.font = dropdownConfig.menuTitleFont
167 | menuTitleLabel.textAlignment = dropdownConfig.cellTextLabelAlignment
168 |
169 | menuArrow = UIImageView(image: dropdownConfig.arrowImage.withRenderingMode(.alwaysTemplate))
170 | menuArrow.tintColor = dropdownConfig.arrowTintColor
171 |
172 | addSubview(menuButton)
173 | menuButton.addSubview(menuTitleLabel)
174 | menuButton.addSubview(menuArrow)
175 |
176 |
177 | let menuWrapperBounds = window.bounds
178 |
179 | //Setup DropdownMenu
180 | menuWrapper = UIView(frame: menuWrapperBounds)
181 | menuWrapper.clipsToBounds = true
182 |
183 | //Setup BackgroundView
184 | backgroundView = UIView(frame: menuWrapperBounds)
185 | backgroundView.backgroundColor = dropdownConfig.maskBuckgroundColor
186 |
187 | let backgroundTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(AnimatedDropdownMenu.hideMenu))
188 | backgroundView.addGestureRecognizer(backgroundTapRecognizer)
189 |
190 | //Setup Default Configuratin
191 | //setupDefaultConfiguration()
192 |
193 | //Setup TableView
194 | tableView = DropdownMenuTableView(frame: CGRect(x: menuWrapperBounds.origin.x, y: -300.0, width: menuWrapperBounds.width, height: 300.0 + dropdownConfig.cellHeight * CGFloat(items.count)), items: items, selectedIndex: selectedIndex, config: dropdownConfig)
195 | tableView.layer.cornerRadius = 5.0
196 | tableView.layer.masksToBounds = true
197 | tableView.selectRowAtIndexPathHandler = {
198 | [weak self] selectedIndex in
199 | guard let strongSelf = self else {
200 | return
201 | }
202 |
203 | strongSelf.didSelectItemAtIndexHandler!(selectedIndex)
204 | strongSelf.menuTitleLabel.text = strongSelf.items[selectedIndex].title
205 |
206 | strongSelf.hideMenu()
207 | strongSelf.layoutSubviews()
208 | }
209 |
210 | menuWrapper.addSubview(backgroundView)
211 | menuWrapper.addSubview(tableView)
212 | containerView.addSubview(menuWrapper)
213 |
214 | menuWrapper.isHidden = true
215 | }
216 |
217 | // MARK: - Life Cycle
218 |
219 | override public func layoutSubviews() {
220 |
221 | menuTitleLabel.sizeToFit()
222 | menuTitleLabel.center = CGPoint(x: frame.size.width * 0.5, y: frame.size.height * 0.5)
223 | menuTitleLabel.textColor = dropdownConfig.menuTitleColor
224 |
225 | menuArrow.center = CGPoint(x: menuTitleLabel.frame.maxX + dropdownConfig.arrowPadding, y: frame.size.height * 0.5)
226 |
227 | menuWrapper.frame.origin.y = (navigationController?.navigationBar.frame.maxY)!
228 | tableView.reloadData()
229 | }
230 |
231 | // MARK: - Private Methods
232 |
233 | fileprivate func setupDefaultConfiguration() {
234 |
235 | menuTitleColor = navigationController?.navigationBar.titleTextAttributes?[NSForegroundColorAttributeName] as? UIColor
236 | cellBackgroundColor = navigationController?.navigationBar.barTintColor
237 | cellTextColor = menuTitleColor
238 | cellSeparatorColor = .clear
239 |
240 | menuArrowTintColor = menuTitleColor
241 | }
242 |
243 | @objc fileprivate func menuButtonTapped(_ sender: UIButton) {
244 | isShown == true ? hideMenu() : showMenu()
245 | }
246 |
247 | @objc fileprivate func hideMenu() {
248 | isShown = false
249 | menuButton.isUserInteractionEnabled = false
250 |
251 | //Rotate Arrow
252 | rotateArrowAnimation()
253 |
254 | //Wapper Animation
255 | backgroundView.alpha = dropdownConfig.maskBackgroundOpacity
256 |
257 | UIView.animate(withDuration: dropdownConfig.animationDuration,
258 | delay: 0,
259 | usingSpringWithDamping: 0.7,
260 | initialSpringVelocity: 0.5,
261 | options: UIViewAnimationOptions(),
262 | animations: {
263 | self.tableView.frame.origin.y = -CGFloat(self.items.count) * self.dropdownConfig.cellHeight - 300.0
264 | self.backgroundView.alpha = 0
265 | }) { finished in
266 | self.menuWrapper.isHidden = true
267 | self.menuButton.isUserInteractionEnabled = true
268 | }
269 | }
270 |
271 | fileprivate func showMenu() {
272 | isShown = true
273 | menuButton.isUserInteractionEnabled = false
274 |
275 | menuWrapper.frame.origin.y = (navigationController?.navigationBar.frame.maxY)!
276 |
277 | let tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: frame.width, height: 300))
278 | tableHeaderView.backgroundColor = dropdownConfig.cellBackgroundColor
279 | tableView.tableHeaderView = tableHeaderView
280 |
281 | //Rotate Arrow
282 | rotateArrowAnimation()
283 |
284 | //Wapper Animation
285 | menuWrapper.isHidden = false
286 | backgroundView.alpha = 0
287 |
288 | tableView.frame.origin.y = -CGFloat(items.count) * dropdownConfig.cellHeight - 300.0
289 | tableView.reloadData()
290 |
291 | menuWrapper.superview?.bringSubview(toFront: menuWrapper)
292 |
293 | UIView.animate(withDuration: dropdownConfig.animationDuration, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: UIViewAnimationOptions(), animations: {
294 | self.tableView.frame.origin.y = CGFloat(-300.0)
295 | self.backgroundView.alpha = self.dropdownConfig.maskBackgroundOpacity
296 | }) { finished in
297 | self.menuButton.isUserInteractionEnabled = true
298 | }
299 | }
300 |
301 | fileprivate func rotateArrowAnimation() {
302 | UIView.animate(withDuration: dropdownConfig.animationDuration) { [weak self] in
303 | guard let strongSelf = self else {
304 | return
305 | }
306 | strongSelf.menuArrow.transform = strongSelf.menuArrow.transform.rotated(by: 180 * CGFloat(M_PI/180))
307 | }
308 | }
309 |
310 | }
311 |
312 | extension UIViewController {
313 |
314 | //Get top visible ViewController in top present level
315 | fileprivate var topViewController: UIViewController? {
316 | return topPresentedViewController?.topVisibleViewController
317 | }
318 |
319 | //Get top presented ViewController
320 | private var topPresentedViewController: UIViewController? {
321 |
322 | var target: UIViewController? = self
323 | if target?.presentedViewController != nil {
324 | target = target?.presentedViewController
325 | }
326 |
327 | return target
328 | }
329 |
330 | //Get top visible ViewController
331 | private var topVisibleViewController: UIViewController? {
332 |
333 | if let navigation = self as? UINavigationController {
334 | if let visibleViewController = navigation.visibleViewController {
335 | return visibleViewController.topVisibleViewController
336 | }
337 | }
338 | if let tab = self as? UITabBarController {
339 | if let selectedViewController = tab.selectedViewController {
340 | return selectedViewController.topVisibleViewController
341 | }
342 | }
343 |
344 | return self
345 | }
346 |
347 | }
348 |
--------------------------------------------------------------------------------
/Source/DropdownMenuCellSeparator.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuCellSeparator.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/3/2.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuCellSeparator: UIView {
12 |
13 | var separatorColor: UIColor {
14 | get {
15 | return self.backgroundColor!
16 | }
17 | set(value) {
18 | self.backgroundColor = value
19 | }
20 | }
21 |
22 | override init(frame: CGRect) {
23 | super.init(frame: frame)
24 | initialize()
25 | }
26 |
27 | required public init?(coder aDecoder: NSCoder) {
28 | super.init(coder: aDecoder)
29 | initialize()
30 | }
31 |
32 | func initialize() {
33 | backgroundColor = UIColor.clear
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Source/DropdownMenuConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuConfig.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/28.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuConfig {
12 |
13 | var menuTitleColor: UIColor?
14 | var menuTitleFont: UIFont!
15 |
16 | var cellHeight: CGFloat!
17 | var cellBackgroundColor: UIColor?
18 | var cellSelectedColor: UIColor?
19 | var cellSeparatorColor: UIColor?
20 | var cellTextLabelColor: UIColor?
21 | var cellTextLabelFont: UIFont!
22 | var cellTextLabelAlignment: NSTextAlignment!
23 | var cellTextLabelSelectedColor: UIColor?
24 | var cellIconImage: UIImage!
25 |
26 | var arrowTintColor: UIColor?
27 | var arrowPadding: CGFloat!
28 | var arrowImage: UIImage!
29 |
30 | var maskBuckgroundColor: UIColor!
31 | var maskBackgroundOpacity: CGFloat!
32 | var animationDuration: TimeInterval!
33 | var shouldChangeTitleText: Bool!
34 | var shouldKeepSelectedCellColor: Bool!
35 |
36 | init() {
37 | configDefaultValue()
38 | }
39 |
40 | fileprivate func configDefaultValue() {
41 | //Path for image
42 | let bundle = Bundle(for: DropdownMenuConfig.self)
43 | let bundleUrl = bundle.url(forResource: "AnimatedDropdownMenu", withExtension: "bundle")
44 | let imageBundle = Bundle(url: bundleUrl!)
45 | let arrowImagePath = imageBundle?.path(forResource: "icon_dropdown_arrow", ofType: "png")
46 |
47 | //Default values
48 | menuTitleColor = UIColor.darkGray
49 | menuTitleFont = UIFont.systemFont(ofSize: 16.0)
50 |
51 | cellHeight = 50.0
52 | cellBackgroundColor = UIColor(red: 216/255.0, green: 85/255.0, blue: 96/255.0, alpha: 1.0)
53 | cellSelectedColor = UIColor.clear
54 | cellSeparatorColor = UIColor.init(white: 1.0, alpha: 0.3)
55 | cellTextLabelColor = UIColor.init(white: 1.0, alpha: 0.3)
56 | cellTextLabelFont = UIFont.systemFont(ofSize: 15.0)
57 | cellTextLabelAlignment = .center
58 | cellTextLabelSelectedColor = UIColor.white
59 |
60 | arrowTintColor = UIColor.darkGray
61 | arrowPadding = 10.0
62 | arrowImage = UIImage(contentsOfFile: arrowImagePath!)
63 |
64 | maskBuckgroundColor = UIColor.black
65 | maskBackgroundOpacity = 0.5
66 | animationDuration = 0.25
67 | shouldChangeTitleText = true
68 | shouldKeepSelectedCellColor = true
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Source/DropdownMenuTableView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuTableView.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/27.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuTableView: UITableView {
12 |
13 | public var selectRowAtIndexPathHandler: ((_ indexPath: Int) -> ())?
14 |
15 | fileprivate var selectedIndex: Int?
16 | fileprivate var items: [AnimatedDropdownMenu.Item] = []
17 | fileprivate var dropdownMenuConfig: DropdownMenuConfig!
18 | fileprivate let kDropdownMenuTableViewCell = "DropdownMenuTableViewCell"
19 |
20 | required public init?(coder aDecoder: NSCoder) {
21 | fatalError("init(coder:) has not been implemented")
22 | }
23 |
24 | init(frame: CGRect, items: [AnimatedDropdownMenu.Item], selectedIndex: Int, config: DropdownMenuConfig) {
25 | super.init(frame: frame, style: .plain)
26 |
27 | self.items = items
28 | self.selectedIndex = selectedIndex
29 | self.dropdownMenuConfig = config
30 |
31 | delegate = self
32 | dataSource = self
33 | separatorStyle = .none
34 | backgroundColor = .clear
35 | autoresizingMask = .flexibleWidth
36 | isScrollEnabled = false
37 | }
38 | }
39 |
40 | extension DropdownMenuTableView: UITableViewDataSource {
41 |
42 | public func numberOfSections(in tableView: UITableView) -> Int {
43 | return 1
44 | }
45 |
46 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
47 | return items.count
48 | }
49 |
50 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
51 |
52 | let cell = DropdownMenuTableViewCell(style: .default, reuseIdentifier: kDropdownMenuTableViewCell, config: dropdownMenuConfig)
53 | cell.textLabel?.text = items[indexPath.row].title
54 |
55 | return cell
56 | }
57 | }
58 |
59 | extension DropdownMenuTableView: UITableViewDelegate {
60 |
61 | public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
62 | return dropdownMenuConfig.cellHeight
63 | }
64 |
65 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
66 |
67 | selectedIndex = indexPath.row
68 | selectRowAtIndexPathHandler!(indexPath.row)
69 | reloadData()
70 | }
71 |
72 | public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
73 |
74 | guard dropdownMenuConfig.shouldKeepSelectedCellColor! else {
75 | return
76 | }
77 |
78 | let tableCell = cell as! DropdownMenuTableViewCell
79 | let icon: UIImage? = items[indexPath.row].icon
80 | let iconLight: UIImage? = items[indexPath.row].iconLight
81 |
82 | if icon != nil && iconLight != nil {
83 | tableCell.iconImageView?.image = (indexPath.row == selectedIndex) ? iconLight : icon
84 | }
85 |
86 | if dropdownMenuConfig.cellSelectedColor != .clear {
87 | cell.contentView.backgroundColor = (indexPath.row == selectedIndex) ?
88 | dropdownMenuConfig.cellSelectedColor :
89 | dropdownMenuConfig.cellBackgroundColor
90 | }
91 |
92 | if dropdownMenuConfig.cellTextLabelSelectedColor != .clear {
93 | tableCell.textLabel?.textColor = (indexPath.row == selectedIndex) ?
94 | dropdownMenuConfig.cellTextLabelSelectedColor :
95 | dropdownMenuConfig.cellTextLabelColor
96 | }
97 |
98 | guard (dropdownMenuConfig.cellSeparatorColor != nil) else {
99 | return
100 | }
101 |
102 | if indexPath.row == items.count - 1 {
103 | tableCell.cellSeparator.separatorColor = .clear
104 | }
105 | else {
106 | tableCell.cellSeparator.separatorColor = dropdownMenuConfig.cellSeparatorColor!
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Source/DropdownMenuTableViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DropdownMenuTableViewCell.swift
3 | // AnimatedDropdownMenu
4 | //
5 | // Created by JonyFang on 17/2/28.
6 | // Copyright © 2017年 JonyFang. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class DropdownMenuTableViewCell: UITableViewCell {
12 |
13 | var iconImageView: UIImageView!
14 | var cellSeparator: DropdownMenuCellSeparator!
15 | var cellContentFrame: CGRect!
16 | var dropdownMenuConfig: DropdownMenuConfig!
17 |
18 | init(style: UITableViewCellStyle, reuseIdentifier: String?, config: DropdownMenuConfig) {
19 | super.init(style: style, reuseIdentifier: reuseIdentifier)
20 |
21 | dropdownMenuConfig = config
22 | cellContentFrame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: dropdownMenuConfig.cellHeight)
23 | contentView.backgroundColor = dropdownMenuConfig.cellBackgroundColor
24 | selectionStyle = .none
25 |
26 | textLabel?.textColor = dropdownMenuConfig.cellTextLabelColor
27 | textLabel?.font = dropdownMenuConfig.cellTextLabelFont
28 | textLabel!.textAlignment = dropdownMenuConfig.cellTextLabelAlignment
29 |
30 | iconImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 16.0, height: 16.0))
31 | iconImageView.image = dropdownMenuConfig.cellIconImage
32 | iconImageView.contentMode = .scaleAspectFill
33 | contentView.addSubview(iconImageView)
34 |
35 | switch textLabel!.textAlignment {
36 | case .left:
37 | textLabel?.frame = CGRect(x: 42, y: 0, width: cellContentFrame.width - 42, height: cellContentFrame.height)
38 | iconImageView.frame = CGRect(x: 16, y: (textLabel?.center.y)! - 8, width: 16, height: 16)
39 | break
40 | case .center:
41 | textLabel?.frame = cellContentFrame
42 | iconImageView.frame = .zero
43 | default:
44 | break
45 | }
46 |
47 | //Add Separator for Cell
48 | cellSeparator = DropdownMenuCellSeparator(frame: CGRect(x: 0, y: cellContentFrame.height, width: cellContentFrame.width, height: 1))
49 | if let cellSeparatorColor = dropdownMenuConfig.cellSeparatorColor {
50 | cellSeparator.separatorColor = cellSeparatorColor
51 | }
52 | contentView.addSubview(cellSeparator)
53 | }
54 |
55 | required public init?(coder aDecoder: NSCoder) {
56 | fatalError("init(coder:) has not been implemented")
57 | }
58 |
59 | override public func layoutSubviews() {
60 | bounds = cellContentFrame
61 | contentView.frame = bounds
62 | }
63 | }
64 |
--------------------------------------------------------------------------------