├── .gitignore ├── .travis.yml ├── BMASliders.podspec ├── BMASlidersFramework.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── BMASliders.xcscheme ├── BMASlidersFramework ├── BMASliders.h └── Info.plist ├── Component ├── Classes │ ├── BMALabeledRangeSlider.h │ ├── BMALabeledRangeSlider.m │ ├── BMALabeledSlider.h │ ├── BMALabeledSlider.m │ ├── BMALabeledSliderConfiguring.h │ ├── BMARangeFormatter.h │ ├── BMARangeSlider.h │ ├── BMARangeSlider.m │ ├── BMASlider.h │ ├── BMASlider.m │ ├── BMASliderLiveRenderingStyle.h │ ├── BMASliderLiveRenderingStyle.m │ ├── BMASliderReusableXibControl.h │ ├── BMASliderReusableXibControl.m │ └── BMASliderStyling.h └── Resources │ ├── BMALabeledRangeSlider.xib │ └── BMALabeledSlider.xib ├── Example ├── BMASlidersExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── BMASlidersExample.xcscheme ├── BMASlidersExample.xcworkspace │ └── contents.xcworkspacedata ├── BMASlidersExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── BMALabeledSliderConfigurator.h │ ├── BMALabeledSliderConfigurator.m │ ├── BMARangeFormatterDistance.h │ ├── BMARangeFormatterDistance.m │ ├── BMARangeFormatterInteger.h │ ├── BMARangeFormatterInteger.m │ ├── BMASliderDefaultStyle.h │ ├── BMASliderDefaultStyle.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── SliderAssets.xcassets │ │ ├── Contents.json │ │ ├── range_slider_handler.imageset │ │ │ ├── Contents.json │ │ │ └── range_slider_handler.pdf │ │ ├── range_slider_selected_background.imageset │ │ │ ├── Contents.json │ │ │ └── range_slider_selected_background.pdf │ │ └── range_slider_unselected_background.imageset │ │ │ ├── Contents.json │ │ │ └── range_slide_unselected_background.pdf │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── Podfile ├── Podfile.lock └── Pods │ ├── Headers │ ├── Private │ │ └── BMASliders │ │ │ ├── BMALabeledRangeSlider.h │ │ │ ├── BMALabeledSlider.h │ │ │ ├── BMALabeledSliderConfiguring.h │ │ │ ├── BMARangeFormatter.h │ │ │ ├── BMARangeSlider.h │ │ │ ├── BMASlider.h │ │ │ ├── BMASliderLiveRenderingStyle.h │ │ │ ├── BMASliderReusableXibControl.h │ │ │ └── BMASliderStyling.h │ └── Public │ │ └── BMASliders │ │ ├── BMALabeledRangeSlider.h │ │ ├── BMALabeledSlider.h │ │ ├── BMALabeledSliderConfiguring.h │ │ ├── BMARangeFormatter.h │ │ ├── BMARangeSlider.h │ │ ├── BMASlider.h │ │ ├── BMASliderLiveRenderingStyle.h │ │ ├── BMASliderReusableXibControl.h │ │ └── BMASliderStyling.h │ ├── Local Podspecs │ └── BMASliders.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ └── project.pbxproj │ └── Target Support Files │ ├── Pods-BMASliders │ ├── Info.plist │ ├── Pods-BMASliders-Private.xcconfig │ ├── Pods-BMASliders-dummy.m │ ├── Pods-BMASliders-prefix.pch │ ├── Pods-BMASliders-umbrella.h │ ├── Pods-BMASliders.modulemap │ └── Pods-BMASliders.xcconfig │ └── Pods │ ├── Info.plist │ ├── Pods-acknowledgements.markdown │ ├── Pods-acknowledgements.plist │ ├── Pods-dummy.m │ ├── Pods-environment.h │ ├── Pods-frameworks.sh │ ├── Pods-resources.sh │ ├── Pods-umbrella.h │ ├── Pods.debug.xcconfig │ ├── Pods.modulemap │ └── Pods.release.xcconfig ├── LICENSE ├── README.md └── demoimages ├── labeled-range-slider-movie.gif └── live-rendering.png /.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 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | xcode_workspace: Example/BMASlidersExample.xcworkspace 3 | xcode_scheme: BMASlidersExample 4 | xcode_sdk: iphonesimulator8.1 5 | -------------------------------------------------------------------------------- /BMASliders.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "BMASliders" 4 | s.version = "1.0.1" 5 | s.summary = "Configurable range and simple sliders, IBInspectable and IBDesignable compatible" 6 | s.description = <<-DESC 7 | BMASliders` is a set of reusable sliders. It includes two kind of sliders, one with customizable ranges -`BMARangeSlider`- and a simpler one -`BMASlider`- along with its labeled counterparts -`BMALabeledRangeSlider` and `BMALabeledSlider` 8 | DESC 9 | s.homepage = "http://github.com/badoo/BMASliders" 10 | s.license = { :type => "MIT"} 11 | s.author = { "Diego Sanchez" => "diego.sanchez@corp.badoo.com" } 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/badoo/BMASliders.git", :tag => s.version.to_s } 14 | s.source_files = "Component/Classes/**/*" 15 | s.public_header_files = "Component/Classes/*.h" 16 | s.resources = "Component/Resources/*" 17 | s.requires_arc = true 18 | 19 | end 20 | -------------------------------------------------------------------------------- /BMASlidersFramework.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C30AA76B1B474D0400BF14FD /* BMALabeledRangeSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA75C1B474D0400BF14FD /* BMALabeledRangeSlider.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | C30AA76C1B474D0400BF14FD /* BMALabeledRangeSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA75D1B474D0400BF14FD /* BMALabeledRangeSlider.m */; }; 12 | C30AA76D1B474D0400BF14FD /* BMALabeledSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA75E1B474D0400BF14FD /* BMALabeledSlider.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | C30AA76E1B474D0400BF14FD /* BMALabeledSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA75F1B474D0400BF14FD /* BMALabeledSlider.m */; }; 14 | C30AA76F1B474D0400BF14FD /* BMALabeledSliderConfiguring.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA7601B474D0400BF14FD /* BMALabeledSliderConfiguring.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | C30AA7711B474D0400BF14FD /* BMARangeSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA7621B474D0400BF14FD /* BMARangeSlider.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | C30AA7721B474D0400BF14FD /* BMARangeSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA7631B474D0400BF14FD /* BMARangeSlider.m */; }; 17 | C30AA7731B474D0400BF14FD /* BMASlider.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA7641B474D0400BF14FD /* BMASlider.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 | C30AA7741B474D0400BF14FD /* BMASlider.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA7651B474D0400BF14FD /* BMASlider.m */; }; 19 | C30AA7751B474D0400BF14FD /* BMASliderLiveRenderingStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA7661B474D0400BF14FD /* BMASliderLiveRenderingStyle.h */; }; 20 | C30AA7761B474D0400BF14FD /* BMASliderLiveRenderingStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA7671B474D0400BF14FD /* BMASliderLiveRenderingStyle.m */; }; 21 | C30AA7771B474D0400BF14FD /* BMASliderReusableXibControl.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA7681B474D0400BF14FD /* BMASliderReusableXibControl.h */; }; 22 | C30AA7781B474D0400BF14FD /* BMASliderReusableXibControl.m in Sources */ = {isa = PBXBuildFile; fileRef = C30AA7691B474D0400BF14FD /* BMASliderReusableXibControl.m */; }; 23 | C30AA7791B474D0400BF14FD /* BMASliderStyling.h in Headers */ = {isa = PBXBuildFile; fileRef = C30AA76A1B474D0400BF14FD /* BMASliderStyling.h */; settings = {ATTRIBUTES = (Public, ); }; }; 24 | C30AA77C1B474D0C00BF14FD /* BMALabeledRangeSlider.xib in Resources */ = {isa = PBXBuildFile; fileRef = C30AA77A1B474D0C00BF14FD /* BMALabeledRangeSlider.xib */; }; 25 | C30AA77D1B474D0C00BF14FD /* BMALabeledSlider.xib in Resources */ = {isa = PBXBuildFile; fileRef = C30AA77B1B474D0C00BF14FD /* BMALabeledSlider.xib */; }; 26 | C334540A1B47473D00FBAC2A /* BMASliders.h in Headers */ = {isa = PBXBuildFile; fileRef = C33454091B47473D00FBAC2A /* BMASliders.h */; settings = {ATTRIBUTES = (Public, ); }; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | C30AA75C1B474D0400BF14FD /* BMALabeledRangeSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMALabeledRangeSlider.h; path = Component/Classes/BMALabeledRangeSlider.h; sourceTree = SOURCE_ROOT; }; 31 | C30AA75D1B474D0400BF14FD /* BMALabeledRangeSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMALabeledRangeSlider.m; path = Component/Classes/BMALabeledRangeSlider.m; sourceTree = SOURCE_ROOT; }; 32 | C30AA75E1B474D0400BF14FD /* BMALabeledSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMALabeledSlider.h; path = Component/Classes/BMALabeledSlider.h; sourceTree = SOURCE_ROOT; }; 33 | C30AA75F1B474D0400BF14FD /* BMALabeledSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMALabeledSlider.m; path = Component/Classes/BMALabeledSlider.m; sourceTree = SOURCE_ROOT; }; 34 | C30AA7601B474D0400BF14FD /* BMALabeledSliderConfiguring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMALabeledSliderConfiguring.h; path = Component/Classes/BMALabeledSliderConfiguring.h; sourceTree = SOURCE_ROOT; }; 35 | C30AA7621B474D0400BF14FD /* BMARangeSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMARangeSlider.h; path = Component/Classes/BMARangeSlider.h; sourceTree = SOURCE_ROOT; }; 36 | C30AA7631B474D0400BF14FD /* BMARangeSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMARangeSlider.m; path = Component/Classes/BMARangeSlider.m; sourceTree = SOURCE_ROOT; }; 37 | C30AA7641B474D0400BF14FD /* BMASlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMASlider.h; path = Component/Classes/BMASlider.h; sourceTree = SOURCE_ROOT; }; 38 | C30AA7651B474D0400BF14FD /* BMASlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMASlider.m; path = Component/Classes/BMASlider.m; sourceTree = SOURCE_ROOT; }; 39 | C30AA7661B474D0400BF14FD /* BMASliderLiveRenderingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMASliderLiveRenderingStyle.h; path = Component/Classes/BMASliderLiveRenderingStyle.h; sourceTree = SOURCE_ROOT; }; 40 | C30AA7671B474D0400BF14FD /* BMASliderLiveRenderingStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMASliderLiveRenderingStyle.m; path = Component/Classes/BMASliderLiveRenderingStyle.m; sourceTree = SOURCE_ROOT; }; 41 | C30AA7681B474D0400BF14FD /* BMASliderReusableXibControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMASliderReusableXibControl.h; path = Component/Classes/BMASliderReusableXibControl.h; sourceTree = SOURCE_ROOT; }; 42 | C30AA7691B474D0400BF14FD /* BMASliderReusableXibControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BMASliderReusableXibControl.m; path = Component/Classes/BMASliderReusableXibControl.m; sourceTree = SOURCE_ROOT; }; 43 | C30AA76A1B474D0400BF14FD /* BMASliderStyling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMASliderStyling.h; path = Component/Classes/BMASliderStyling.h; sourceTree = SOURCE_ROOT; }; 44 | C30AA77A1B474D0C00BF14FD /* BMALabeledRangeSlider.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = BMALabeledRangeSlider.xib; path = Component/Resources/BMALabeledRangeSlider.xib; sourceTree = SOURCE_ROOT; }; 45 | C30AA77B1B474D0C00BF14FD /* BMALabeledSlider.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = BMALabeledSlider.xib; path = Component/Resources/BMALabeledSlider.xib; sourceTree = SOURCE_ROOT; }; 46 | C33454041B47473D00FBAC2A /* BMASlidersFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BMASlidersFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | C33454081B47473D00FBAC2A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | C33454091B47473D00FBAC2A /* BMASliders.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BMASliders.h; sourceTree = ""; }; 49 | C35D87031B47543200766FD0 /* BMASlidersFramework copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "BMASlidersFramework copy-Info.plist"; path = "/Users/diegosanchez/branches/BMASliders/BMASlidersFramework copy-Info.plist"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | C33454001B47473D00FBAC2A /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | C33453FA1B47473D00FBAC2A = { 64 | isa = PBXGroup; 65 | children = ( 66 | C33454061B47473D00FBAC2A /* BMASlidersFramework */, 67 | C33454051B47473D00FBAC2A /* Products */, 68 | C35D87031B47543200766FD0 /* BMASlidersFramework copy-Info.plist */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | C33454051B47473D00FBAC2A /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | C33454041B47473D00FBAC2A /* BMASlidersFramework.framework */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | C33454061B47473D00FBAC2A /* BMASlidersFramework */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | C33454091B47473D00FBAC2A /* BMASliders.h */, 84 | C33454221B4747FA00FBAC2A /* Component */, 85 | C33454071B47473D00FBAC2A /* Supporting Files */, 86 | ); 87 | path = BMASlidersFramework; 88 | sourceTree = ""; 89 | }; 90 | C33454071B47473D00FBAC2A /* Supporting Files */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | C33454081B47473D00FBAC2A /* Info.plist */, 94 | ); 95 | name = "Supporting Files"; 96 | sourceTree = ""; 97 | }; 98 | C33454221B4747FA00FBAC2A /* Component */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | C30AA75C1B474D0400BF14FD /* BMALabeledRangeSlider.h */, 102 | C30AA75D1B474D0400BF14FD /* BMALabeledRangeSlider.m */, 103 | C30AA77A1B474D0C00BF14FD /* BMALabeledRangeSlider.xib */, 104 | C30AA75E1B474D0400BF14FD /* BMALabeledSlider.h */, 105 | C30AA75F1B474D0400BF14FD /* BMALabeledSlider.m */, 106 | C30AA77B1B474D0C00BF14FD /* BMALabeledSlider.xib */, 107 | C30AA7601B474D0400BF14FD /* BMALabeledSliderConfiguring.h */, 108 | C30AA7621B474D0400BF14FD /* BMARangeSlider.h */, 109 | C30AA7631B474D0400BF14FD /* BMARangeSlider.m */, 110 | C30AA7641B474D0400BF14FD /* BMASlider.h */, 111 | C30AA7651B474D0400BF14FD /* BMASlider.m */, 112 | C30AA7661B474D0400BF14FD /* BMASliderLiveRenderingStyle.h */, 113 | C30AA7671B474D0400BF14FD /* BMASliderLiveRenderingStyle.m */, 114 | C30AA7681B474D0400BF14FD /* BMASliderReusableXibControl.h */, 115 | C30AA7691B474D0400BF14FD /* BMASliderReusableXibControl.m */, 116 | C30AA76A1B474D0400BF14FD /* BMASliderStyling.h */, 117 | ); 118 | name = Component; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXHeadersBuildPhase section */ 124 | C33454011B47473D00FBAC2A /* Headers */ = { 125 | isa = PBXHeadersBuildPhase; 126 | buildActionMask = 2147483647; 127 | files = ( 128 | C30AA76D1B474D0400BF14FD /* BMALabeledSlider.h in Headers */, 129 | C30AA7711B474D0400BF14FD /* BMARangeSlider.h in Headers */, 130 | C30AA7791B474D0400BF14FD /* BMASliderStyling.h in Headers */, 131 | C30AA7771B474D0400BF14FD /* BMASliderReusableXibControl.h in Headers */, 132 | C30AA76B1B474D0400BF14FD /* BMALabeledRangeSlider.h in Headers */, 133 | C30AA76F1B474D0400BF14FD /* BMALabeledSliderConfiguring.h in Headers */, 134 | C30AA7751B474D0400BF14FD /* BMASliderLiveRenderingStyle.h in Headers */, 135 | C30AA7731B474D0400BF14FD /* BMASlider.h in Headers */, 136 | C334540A1B47473D00FBAC2A /* BMASliders.h in Headers */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXHeadersBuildPhase section */ 141 | 142 | /* Begin PBXNativeTarget section */ 143 | C33454031B47473D00FBAC2A /* BMASliders */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = C334541A1B47473D00FBAC2A /* Build configuration list for PBXNativeTarget "BMASliders" */; 146 | buildPhases = ( 147 | C33453FF1B47473D00FBAC2A /* Sources */, 148 | C33454001B47473D00FBAC2A /* Frameworks */, 149 | C33454011B47473D00FBAC2A /* Headers */, 150 | C33454021B47473D00FBAC2A /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = BMASliders; 157 | productName = BMASlidersFramework; 158 | productReference = C33454041B47473D00FBAC2A /* BMASlidersFramework.framework */; 159 | productType = "com.apple.product-type.framework"; 160 | }; 161 | /* End PBXNativeTarget section */ 162 | 163 | /* Begin PBXProject section */ 164 | C33453FB1B47473D00FBAC2A /* Project object */ = { 165 | isa = PBXProject; 166 | attributes = { 167 | LastUpgradeCheck = 0640; 168 | ORGANIZATIONNAME = Badoo; 169 | TargetAttributes = { 170 | C33454031B47473D00FBAC2A = { 171 | CreatedOnToolsVersion = 6.4; 172 | }; 173 | }; 174 | }; 175 | buildConfigurationList = C33453FE1B47473D00FBAC2A /* Build configuration list for PBXProject "BMASlidersFramework" */; 176 | compatibilityVersion = "Xcode 3.2"; 177 | developmentRegion = English; 178 | hasScannedForEncodings = 0; 179 | knownRegions = ( 180 | en, 181 | ); 182 | mainGroup = C33453FA1B47473D00FBAC2A; 183 | productRefGroup = C33454051B47473D00FBAC2A /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | C33454031B47473D00FBAC2A /* BMASliders */, 188 | ); 189 | }; 190 | /* End PBXProject section */ 191 | 192 | /* Begin PBXResourcesBuildPhase section */ 193 | C33454021B47473D00FBAC2A /* Resources */ = { 194 | isa = PBXResourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | C30AA77C1B474D0C00BF14FD /* BMALabeledRangeSlider.xib in Resources */, 198 | C30AA77D1B474D0C00BF14FD /* BMALabeledSlider.xib in Resources */, 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXResourcesBuildPhase section */ 203 | 204 | /* Begin PBXSourcesBuildPhase section */ 205 | C33453FF1B47473D00FBAC2A /* Sources */ = { 206 | isa = PBXSourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | C30AA7781B474D0400BF14FD /* BMASliderReusableXibControl.m in Sources */, 210 | C30AA7721B474D0400BF14FD /* BMARangeSlider.m in Sources */, 211 | C30AA7761B474D0400BF14FD /* BMASliderLiveRenderingStyle.m in Sources */, 212 | C30AA7741B474D0400BF14FD /* BMASlider.m in Sources */, 213 | C30AA76C1B474D0400BF14FD /* BMALabeledRangeSlider.m in Sources */, 214 | C30AA76E1B474D0400BF14FD /* BMALabeledSlider.m in Sources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXSourcesBuildPhase section */ 219 | 220 | /* Begin XCBuildConfiguration section */ 221 | C33454181B47473D00FBAC2A /* Debug */ = { 222 | isa = XCBuildConfiguration; 223 | buildSettings = { 224 | ALWAYS_SEARCH_USER_PATHS = NO; 225 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 226 | CLANG_CXX_LIBRARY = "libc++"; 227 | CLANG_ENABLE_MODULES = YES; 228 | CLANG_ENABLE_OBJC_ARC = YES; 229 | CLANG_WARN_BOOL_CONVERSION = YES; 230 | CLANG_WARN_CONSTANT_CONVERSION = YES; 231 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 232 | CLANG_WARN_EMPTY_BODY = YES; 233 | CLANG_WARN_ENUM_CONVERSION = YES; 234 | CLANG_WARN_INT_CONVERSION = YES; 235 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 236 | CLANG_WARN_UNREACHABLE_CODE = YES; 237 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 238 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 239 | COPY_PHASE_STRIP = NO; 240 | CURRENT_PROJECT_VERSION = 1; 241 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 242 | ENABLE_STRICT_OBJC_MSGSEND = YES; 243 | GCC_C_LANGUAGE_STANDARD = gnu99; 244 | GCC_DYNAMIC_NO_PIC = NO; 245 | GCC_NO_COMMON_BLOCKS = YES; 246 | GCC_OPTIMIZATION_LEVEL = 0; 247 | GCC_PREPROCESSOR_DEFINITIONS = ( 248 | "DEBUG=1", 249 | "$(inherited)", 250 | ); 251 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 252 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 253 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 254 | GCC_WARN_UNDECLARED_SELECTOR = YES; 255 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 256 | GCC_WARN_UNUSED_FUNCTION = YES; 257 | GCC_WARN_UNUSED_VARIABLE = YES; 258 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 259 | MTL_ENABLE_DEBUG_INFO = YES; 260 | ONLY_ACTIVE_ARCH = YES; 261 | SDKROOT = iphoneos; 262 | TARGETED_DEVICE_FAMILY = "1,2"; 263 | VERSIONING_SYSTEM = "apple-generic"; 264 | VERSION_INFO_PREFIX = ""; 265 | }; 266 | name = Debug; 267 | }; 268 | C33454191B47473D00FBAC2A /* Release */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ALWAYS_SEARCH_USER_PATHS = NO; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BOOL_CONVERSION = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INT_CONVERSION = YES; 282 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | CURRENT_PROJECT_VERSION = 1; 288 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 289 | ENABLE_NS_ASSERTIONS = NO; 290 | ENABLE_STRICT_OBJC_MSGSEND = YES; 291 | GCC_C_LANGUAGE_STANDARD = gnu99; 292 | GCC_NO_COMMON_BLOCKS = YES; 293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 295 | GCC_WARN_UNDECLARED_SELECTOR = YES; 296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 297 | GCC_WARN_UNUSED_FUNCTION = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 300 | MTL_ENABLE_DEBUG_INFO = NO; 301 | SDKROOT = iphoneos; 302 | TARGETED_DEVICE_FAMILY = "1,2"; 303 | VALIDATE_PRODUCT = YES; 304 | VERSIONING_SYSTEM = "apple-generic"; 305 | VERSION_INFO_PREFIX = ""; 306 | }; 307 | name = Release; 308 | }; 309 | C334541B1B47473D00FBAC2A /* Debug */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | DEFINES_MODULE = YES; 313 | DYLIB_COMPATIBILITY_VERSION = 1; 314 | DYLIB_CURRENT_VERSION = 1; 315 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 316 | INFOPLIST_FILE = BMASlidersFramework/Info.plist; 317 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | SKIP_INSTALL = YES; 321 | }; 322 | name = Debug; 323 | }; 324 | C334541C1B47473D00FBAC2A /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | DEFINES_MODULE = YES; 328 | DYLIB_COMPATIBILITY_VERSION = 1; 329 | DYLIB_CURRENT_VERSION = 1; 330 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 331 | INFOPLIST_FILE = BMASlidersFramework/Info.plist; 332 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 334 | PRODUCT_NAME = "$(TARGET_NAME)"; 335 | SKIP_INSTALL = YES; 336 | }; 337 | name = Release; 338 | }; 339 | /* End XCBuildConfiguration section */ 340 | 341 | /* Begin XCConfigurationList section */ 342 | C33453FE1B47473D00FBAC2A /* Build configuration list for PBXProject "BMASlidersFramework" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | C33454181B47473D00FBAC2A /* Debug */, 346 | C33454191B47473D00FBAC2A /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | C334541A1B47473D00FBAC2A /* Build configuration list for PBXNativeTarget "BMASliders" */ = { 352 | isa = XCConfigurationList; 353 | buildConfigurations = ( 354 | C334541B1B47473D00FBAC2A /* Debug */, 355 | C334541C1B47473D00FBAC2A /* Release */, 356 | ); 357 | defaultConfigurationIsVisible = 0; 358 | defaultConfigurationName = Release; 359 | }; 360 | /* End XCConfigurationList section */ 361 | }; 362 | rootObject = C33453FB1B47473D00FBAC2A /* Project object */; 363 | } 364 | -------------------------------------------------------------------------------- /BMASlidersFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BMASlidersFramework.xcodeproj/xcshareddata/xcschemes/BMASliders.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /BMASlidersFramework/BMASliders.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | 27 | //! Project version number for BMASlidersFramework. 28 | FOUNDATION_EXPORT double BMASlidersFrameworkVersionNumber; 29 | 30 | //! Project version string for BMASlidersFramework. 31 | FOUNDATION_EXPORT const unsigned char BMASlidersFrameworkVersionString[]; 32 | 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import -------------------------------------------------------------------------------- /BMASlidersFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.badoo.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Component/Classes/BMALabeledRangeSlider.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | #import "BMARangeSlider.h" 27 | #import "BMARangeFormatter.h" 28 | #import "BMALabeledSliderConfiguring.h" 29 | #import "BMASliderReusableXibControl.h" 30 | 31 | IB_DESIGNABLE 32 | @interface BMALabeledRangeSlider : BMASliderReusableXibControl 33 | 34 | #pragma mark - BMASlider 35 | @property (nonatomic) id style; // Default is BMASliderDefaultStyle 36 | @property (nonatomic) IBInspectable CGFloat minimumValue; 37 | @property (nonatomic) IBInspectable CGFloat maximumValue; 38 | @property (nonatomic) IBInspectable CGFloat currentLowerValue; 39 | @property (nonatomic) IBInspectable CGFloat currentUpperValue; 40 | @property (nonatomic) IBInspectable CGFloat step; 41 | @property (nonatomic) IBInspectable CGFloat minimumDistance; 42 | @property (nonatomic, getter=isContinuous) IBInspectable BOOL continuous; 43 | 44 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 45 | @property (weak, nonatomic) IBOutlet UILabel *rangeDetailLabel; 46 | 47 | #pragma mark - BMALabeledSliderConfiguring 48 | @property (nonatomic, copy) NSAttributedString *title; 49 | @property (nonatomic, strong) id rangeFormatter; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Component/Classes/BMALabeledRangeSlider.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMALabeledRangeSlider.h" 26 | 27 | @interface BMALabeledRangeSlider () 28 | 29 | @property (weak, nonatomic) IBOutlet BMARangeSlider *rangeSlider; 30 | 31 | @end 32 | 33 | @implementation BMALabeledRangeSlider 34 | 35 | - (void)awakeFromNib { 36 | [super awakeFromNib]; 37 | self.backgroundColor = [UIColor clearColor]; 38 | [self.rangeSlider addTarget:self action:@selector(handleValueChange) forControlEvents:UIControlEventValueChanged]; 39 | [self.rangeSlider addTarget:self action:@selector(handleEditingDidEnd) forControlEvents:UIControlEventEditingDidEnd]; 40 | [self updateRangeDetailLabel]; 41 | } 42 | 43 | - (void)setTitle:(NSAttributedString *)title { 44 | _title = [title copy]; 45 | self.titleLabel.attributedText = title; 46 | } 47 | 48 | #pragma mark - Slider forwarding 49 | 50 | - (void)setMaximumValue:(CGFloat)maximumValue { 51 | self.rangeSlider.maximumValue = maximumValue; 52 | } 53 | 54 | - (CGFloat)maximumValue { 55 | return self.rangeSlider.maximumValue; 56 | } 57 | 58 | - (void)setMinimumValue:(CGFloat)minimumValue { 59 | self.rangeSlider.minimumValue = minimumValue; 60 | } 61 | 62 | - (CGFloat)minimumValue { 63 | return self.rangeSlider.minimumValue; 64 | } 65 | 66 | - (void)setCurrentLowerValue:(CGFloat)currentLowerValue { 67 | self.rangeSlider.currentLowerValue = currentLowerValue; 68 | [self updateRangeDetailLabel]; 69 | } 70 | 71 | - (CGFloat)currentLowerValue { 72 | return self.rangeSlider.currentLowerValue; 73 | } 74 | 75 | - (void)setCurrentUpperValue:(CGFloat)currentUpperValue { 76 | self.rangeSlider.currentUpperValue = currentUpperValue; 77 | [self updateRangeDetailLabel]; 78 | } 79 | 80 | - (CGFloat)currentUpperValue { 81 | return self.rangeSlider.currentUpperValue; 82 | } 83 | 84 | - (void)setLowerBound:(CGFloat)lowerBound animated:(BOOL)animated { 85 | [self.rangeSlider setLowerBound:lowerBound animated:animated]; 86 | } 87 | 88 | - (void)setUpperBound:(CGFloat)upperBound animated:(BOOL)animated { 89 | [self.rangeSlider setUpperBound:upperBound animated:animated]; 90 | } 91 | 92 | - (void)setMinimumDistance:(CGFloat)minimumDistance { 93 | [self.rangeSlider setMinimumDistance:minimumDistance]; 94 | } 95 | 96 | - (CGFloat)minimumDistance { 97 | return self.rangeSlider.minimumDistance; 98 | } 99 | 100 | - (void)setStyle:(id)style { 101 | self.rangeSlider.style = style; 102 | } 103 | 104 | - (id)style { 105 | return self.rangeSlider.style; 106 | } 107 | 108 | - (void)handleValueChange { 109 | [self updateRangeDetailLabel]; 110 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 111 | } 112 | 113 | - (void)handleEditingDidEnd { 114 | [self sendActionsForControlEvents:UIControlEventEditingDidEnd]; 115 | } 116 | 117 | - (void)setStep:(CGFloat)step { 118 | self.rangeSlider.step = step; 119 | } 120 | 121 | - (CGFloat)step { 122 | return self.rangeSlider.step; 123 | } 124 | 125 | - (void)setContinuous:(BOOL)continuous { 126 | self.rangeSlider.continuous = continuous; 127 | } 128 | 129 | - (BOOL)continuous { 130 | return self.rangeSlider.continuous; 131 | } 132 | 133 | - (BOOL)isOverflow { 134 | return [self.rangeSlider isOverflow]; 135 | } 136 | 137 | - (BOOL)isUnderflow { 138 | return [self.rangeSlider isUnderflow]; 139 | } 140 | 141 | #pragma mark - Detail formatting 142 | 143 | - (void)setRangeFormatter:(id)rangeFormatter { 144 | _rangeFormatter = rangeFormatter; 145 | [self updateRangeDetailLabel]; 146 | } 147 | 148 | - (void)updateRangeDetailLabel { 149 | [self updateRangeFormatter]; 150 | self.rangeDetailLabel.attributedText = self.rangeFormatter.formattedString; 151 | } 152 | 153 | - (void)updateRangeFormatter { 154 | self.rangeFormatter.hasLowerValue = YES; 155 | self.rangeFormatter.lowerValue = self.currentLowerValue; 156 | self.rangeFormatter.upperValue = self.currentUpperValue; 157 | self.rangeFormatter.overflow = self.overflow; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /Component/Classes/BMALabeledSlider.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | #import "BMASlider.h" 27 | #import "BMARangeFormatter.h" 28 | #import "BMALabeledSliderConfiguring.h" 29 | #import "BMASliderReusableXibControl.h" 30 | 31 | IB_DESIGNABLE 32 | @interface BMALabeledSlider : BMASliderReusableXibControl 33 | 34 | #pragma mark - BMASlider 35 | @property (nonatomic) id style; // Default is BMASliderDefaultStyle 36 | @property (nonatomic) IBInspectable CGFloat minimumValue; 37 | @property (nonatomic) IBInspectable CGFloat maximumValue; 38 | @property (nonatomic) CGFloat currentValue; 39 | @property (nonatomic) IBInspectable CGFloat step; 40 | @property (nonatomic, getter=isContinuous) IBInspectable BOOL continuous; 41 | 42 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 43 | @property (weak, nonatomic) IBOutlet UILabel *rangeDetailLabel; 44 | 45 | #pragma mark - BMALabeledSliderConfiguring 46 | @property (nonatomic, copy) NSAttributedString *title; 47 | @property (nonatomic, strong) id rangeFormatter; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Component/Classes/BMALabeledSlider.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMALabeledSlider.h" 26 | 27 | @interface BMALabeledSlider () 28 | @property (weak, nonatomic) IBOutlet BMASlider *rangeSlider; 29 | @end 30 | 31 | @implementation BMALabeledSlider 32 | 33 | - (void)awakeFromNib { 34 | [super awakeFromNib]; 35 | self.backgroundColor = [UIColor clearColor]; 36 | [self.rangeSlider addTarget:self action:@selector(handleValueChange) forControlEvents:UIControlEventValueChanged]; 37 | [self.rangeSlider addTarget:self action:@selector(handleEditingDidEnd) forControlEvents:UIControlEventEditingDidEnd]; 38 | [self updateRangeDetailLabel]; 39 | } 40 | 41 | - (void)setTitle:(NSAttributedString *)title { 42 | _title = [title copy]; 43 | self.titleLabel.attributedText = title; 44 | } 45 | 46 | #pragma mark - Slider forwarding 47 | 48 | - (void)setCurrentValue:(CGFloat)value { 49 | self.rangeSlider.currentValue = value; 50 | [self updateRangeDetailLabel]; 51 | } 52 | 53 | - (void)setCurrentValue:(CGFloat)value animated:(BOOL)animated { 54 | [self.rangeSlider setCurrentValue:value animated:animated]; 55 | } 56 | 57 | - (CGFloat)currentValue { 58 | return self.rangeSlider.currentValue; 59 | } 60 | 61 | - (void)setMaximumValue:(CGFloat)maximumValue { 62 | self.rangeSlider.maximumValue = maximumValue; 63 | } 64 | 65 | - (CGFloat)maximumValue { 66 | return self.rangeSlider.maximumValue; 67 | } 68 | 69 | - (void)setMinimumValue:(CGFloat)minimumValue { 70 | self.rangeSlider.minimumValue = minimumValue; 71 | } 72 | 73 | - (CGFloat)minimumValue { 74 | return self.rangeSlider.minimumValue; 75 | } 76 | 77 | - (void)setStyle:(id)style { 78 | self.rangeSlider.style = style; 79 | } 80 | 81 | - (id)style { 82 | return self.rangeSlider.style; 83 | } 84 | 85 | - (void)handleValueChange { 86 | [self updateRangeDetailLabel]; 87 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 88 | } 89 | 90 | - (void)handleEditingDidEnd { 91 | [self sendActionsForControlEvents:UIControlEventEditingDidEnd]; 92 | } 93 | 94 | - (void)setStep:(CGFloat)step { 95 | self.rangeSlider.step = step; 96 | } 97 | 98 | - (CGFloat)step { 99 | return self.rangeSlider.step; 100 | } 101 | 102 | - (void)setContinuous:(BOOL)continuous { 103 | self.rangeSlider.continuous = continuous; 104 | } 105 | 106 | - (BOOL)continuous { 107 | return self.rangeSlider.continuous; 108 | } 109 | 110 | - (BOOL)isOverflow { 111 | return [self.rangeSlider isOverflow]; 112 | } 113 | 114 | #pragma mark - Range formatting 115 | 116 | #pragma mark - Detail formatting 117 | 118 | - (void)setRangeFormatter:(id)rangeFormatter { 119 | _rangeFormatter = rangeFormatter; 120 | [self updateRangeDetailLabel]; 121 | } 122 | 123 | - (void)updateRangeDetailLabel { 124 | [self updateRangeFormatter]; 125 | NSAssert(!self.rangeFormatter || [self.rangeFormatter.formattedString isKindOfClass:[NSAttributedString class]], @"kk"); 126 | 127 | self.rangeDetailLabel.attributedText = self.rangeFormatter.formattedString; 128 | } 129 | 130 | - (void)updateRangeFormatter { 131 | self.rangeFormatter.hasLowerValue = NO; 132 | self.rangeFormatter.upperValue = self.currentValue; 133 | self.rangeFormatter.overflow = self.overflow; 134 | } 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /Component/Classes/BMALabeledSliderConfiguring.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import Foundation; 26 | #import "BMARangeFormatter.h" 27 | 28 | @protocol BMALabeledSliderConfiguring 29 | 30 | @property (nonatomic, copy) NSAttributedString *title; 31 | @property (nonatomic) id rangeFormatter; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Component/Classes/BMARangeFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | @import Foundation; 25 | @import UIKit; 26 | 27 | @protocol BMARangeFormatter 28 | 29 | @property (nonatomic) BOOL hasLowerValue; 30 | @property (nonatomic) CGFloat lowerValue; 31 | @property (nonatomic) CGFloat upperValue; 32 | @property (nonatomic, getter=isOverflow) BOOL overflow; 33 | 34 | - (NSAttributedString *)formattedString; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Component/Classes/BMARangeSlider.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | #import "BMASliderStyling.h" 27 | 28 | @protocol BMARangeSlider 29 | 30 | @property (nonatomic) id style; 31 | 32 | @property (nonatomic) CGFloat minimumValue; 33 | @property (nonatomic) CGFloat maximumValue; 34 | 35 | @property (nonatomic) CGFloat currentLowerValue; 36 | @property (nonatomic) CGFloat currentUpperValue; 37 | 38 | @property (nonatomic) CGFloat minimumDistance; 39 | 40 | /** 41 | * if YES, indicates the user is (significantly) touching beyond the maximumValue 42 | */ 43 | @property (nonatomic, readonly, getter=isOverflow) BOOL overflow; 44 | 45 | /** 46 | * if YES, indicates the user is (significantly) touching beyond the minimumValue 47 | */ 48 | @property (nonatomic, readonly, getter=isUnderflow) BOOL underflow; 49 | 50 | - (void)setLowerBound:(CGFloat)value animated:(BOOL)animated; 51 | - (void)setUpperBound:(CGFloat)value animated:(BOOL)animated; 52 | 53 | /** 54 | * if > 0, values are discretized as k*Step. 55 | */ 56 | @property (nonatomic) CGFloat step; 57 | 58 | /** 59 | * if NO, notifies of changes once user finish interaction. Default is YES 60 | */ 61 | @property (nonatomic, getter=isContinuous) BOOL continuous; 62 | 63 | @end 64 | 65 | IB_DESIGNABLE 66 | @interface BMARangeSlider : UIControl 67 | 68 | @property (nonatomic) id style UI_APPEARANCE_SELECTOR; // Default is BMASliderLiveRenderingStyle 69 | @property (nonatomic) IBInspectable CGFloat minimumValue; 70 | @property (nonatomic) IBInspectable CGFloat maximumValue; 71 | @property (nonatomic) IBInspectable CGFloat currentLowerValue; 72 | @property (nonatomic) IBInspectable CGFloat currentUpperValue; 73 | @property (nonatomic) IBInspectable CGFloat step; 74 | @property (nonatomic) IBInspectable CGFloat minimumDistance; 75 | @property (nonatomic, getter=isContinuous) IBInspectable BOOL continuous; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Component/Classes/BMARangeSlider.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMARangeSlider.h" 26 | #import "BMASliderLiveRenderingStyle.h" 27 | 28 | typedef NS_ENUM(NSUInteger, BMARangeSliderHandler) { 29 | BMARangeSliderHandlerNone, 30 | BMARangeSliderHandlerLower, 31 | BMARangeSliderHandlerUpper 32 | }; 33 | 34 | @interface BMARangeSlider () 35 | 36 | @property (nonatomic, strong) UIView *slidingView; 37 | @property (nonatomic, strong) UIImageView *selectedRangeImageView; 38 | @property (nonatomic, strong) UIImageView *backgroundRangeImageView; 39 | @property (nonatomic, strong) UIImageView *lowerHandler; 40 | @property (nonatomic, strong) UIImageView *upperHandler; 41 | @property (nonatomic) UIEdgeInsets touchEdgeInsets; 42 | @property (nonatomic, readwrite, getter=isUnderflow) BOOL underflow; 43 | @property (nonatomic, readwrite, getter=isOverflow) BOOL overflow; 44 | 45 | @end 46 | 47 | @implementation BMARangeSlider 48 | 49 | - (instancetype)init { 50 | self = [super init]; 51 | if (self) { 52 | [self commonInit]; 53 | } 54 | return self; 55 | } 56 | 57 | - (instancetype)initWithFrame:(CGRect)frame { 58 | self = [super initWithFrame:frame]; 59 | if (self) { 60 | [self commonInit]; 61 | } 62 | return self; 63 | } 64 | 65 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 66 | self = [super initWithCoder:aDecoder]; 67 | if (self) { 68 | [self commonInit]; 69 | } 70 | return self; 71 | } 72 | 73 | - (void)commonInit { 74 | [self setUpDefaultStyle]; 75 | [self setUpDefaultValues]; 76 | [self setUpViews]; 77 | } 78 | 79 | - (void)setUpDefaultStyle { 80 | _style = [[BMASliderLiveRenderingStyle alloc] init]; 81 | } 82 | 83 | - (void)setUpDefaultValues { 84 | _maximumValue = 100.; 85 | _minimumValue = 0.; 86 | _currentLowerValue = 30.; 87 | _currentUpperValue = 70.; 88 | _step = 1.; 89 | _continuous = YES; 90 | } 91 | 92 | - (void)setUpViews { 93 | self.backgroundColor = [UIColor clearColor]; 94 | CGPoint center = CGPointMake(self.bounds.size.width / 2., self.bounds.size.height / 2.); 95 | 96 | _lowerHandler = [[UIImageView alloc] init]; 97 | _lowerHandler.center = center; 98 | 99 | _upperHandler = [[UIImageView alloc] init]; 100 | _upperHandler.center = center; 101 | 102 | _backgroundRangeImageView = [[UIImageView alloc] init]; 103 | [self updateView:_backgroundRangeImageView frameChange:^(CGRect *frame) { 104 | frame->size.width = self.bounds.size.width; 105 | }]; 106 | _backgroundRangeImageView.center = center; 107 | _backgroundRangeImageView.frame = CGRectIntegral(_backgroundRangeImageView.frame); 108 | _backgroundRangeImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 109 | 110 | _slidingView = [[UIView alloc] init]; 111 | _slidingView.userInteractionEnabled = NO; 112 | 113 | _selectedRangeImageView = [[UIImageView alloc] init]; 114 | _selectedRangeImageView.center = center; 115 | _selectedRangeImageView.frame = CGRectIntegral(_selectedRangeImageView.frame); 116 | _selectedRangeImageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 117 | 118 | [self addSubview:_slidingView]; 119 | [self addSubview:_backgroundRangeImageView]; 120 | [self addSubview:_selectedRangeImageView]; 121 | [self addSubview:_lowerHandler]; 122 | [self addSubview:_upperHandler]; 123 | 124 | [self updateStyle]; 125 | } 126 | 127 | - (void)setStyle:(id)style { 128 | _style = style; 129 | [self updateStyle]; 130 | } 131 | 132 | - (void)updateStyle { 133 | self.lowerHandler.image = [self handlerImage]; 134 | self.upperHandler.image = [self handlerImage]; 135 | self.backgroundRangeImageView.image = [self unselectedLineImage]; 136 | self.selectedRangeImageView.image = [self selectedLineImage]; 137 | 138 | [self updateView:self.lowerHandler frameChange:^(CGRect *frame) { 139 | frame->size = [self handlerImage].size; 140 | }]; 141 | 142 | [self updateView:self.upperHandler frameChange:^(CGRect *frame) { 143 | frame->size = [self handlerImage].size; 144 | }]; 145 | 146 | [self updateView:self.selectedRangeImageView frameChange:^(CGRect *frame) { 147 | frame->size.height = [self lineHeight]; 148 | }]; 149 | 150 | [self updateView:self.backgroundRangeImageView frameChange:^(CGRect *frame) { 151 | frame->size.height = [self lineHeight]; 152 | }]; 153 | } 154 | 155 | - (void)layoutSubviews { 156 | [super layoutSubviews]; 157 | [self updateUI]; 158 | } 159 | 160 | - (void)updateUI { 161 | [self updateSlidingView]; 162 | [self updateSelectedRange]; 163 | [self placeHandlers]; 164 | } 165 | 166 | - (void)updateSlidingView { 167 | self.slidingView.frame = UIEdgeInsetsInsetRect(_backgroundRangeImageView.frame, [self slidingViewEdgeInsets]); 168 | } 169 | 170 | - (void)updateSelectedRange { 171 | CGFloat width = [self selectedRangeNormalizedLength] * self.slidingView.bounds.size.width; 172 | CGFloat originX = [self selectedRangeNormalizedOrigin] * self.slidingView.bounds.size.width + self.slidingView.frame.origin.x; 173 | 174 | [self updateView:self.selectedRangeImageView frameChange:^(CGRect *frame) { 175 | frame->size.width = width; 176 | frame->origin.x = originX; 177 | }]; 178 | } 179 | 180 | - (void)placeHandlers { 181 | self.lowerHandler.center = CGPointMake(self.selectedRangeImageView.frame.origin.x, self.backgroundRangeImageView.center.y); 182 | self.upperHandler.center = CGPointMake(CGRectGetMaxX(self.selectedRangeImageView.frame), self.backgroundRangeImageView.center.y); 183 | } 184 | 185 | #pragma mark - Convenience accessors 186 | 187 | - (CGFloat)selectedRangeNormalizedLength { 188 | return (self.currentUpperValue - self.currentLowerValue) / (self.maximumValue - self.minimumValue); 189 | } 190 | 191 | - (CGFloat)selectedRangeNormalizedOrigin { 192 | return (self.currentLowerValue - self.minimumValue) / (self.maximumValue - self.minimumValue); 193 | } 194 | 195 | #pragma mark - User interaction 196 | 197 | - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 198 | BMARangeSliderHandler targetHandler = [self targetHandlerWithTouch:touch]; 199 | 200 | if (targetHandler == BMARangeSliderHandlerLower) { 201 | self.lowerHandler.highlighted = YES; 202 | [self bringSubviewToFront:self.lowerHandler]; 203 | } else if (targetHandler == BMARangeSliderHandlerUpper) { 204 | self.upperHandler.highlighted = YES; 205 | [self bringSubviewToFront:self.upperHandler]; 206 | } 207 | 208 | return YES; 209 | } 210 | 211 | - (BMARangeSliderHandler)targetHandlerWithTouch:(UITouch *)touch { 212 | BMARangeSliderHandler targetHandler = BMARangeSliderHandlerNone; 213 | 214 | CGPoint touchPoint = [touch locationInView:self]; 215 | BOOL touchesLowerHandler = CGRectContainsPoint(UIEdgeInsetsInsetRect(self.lowerHandler.frame, self.touchEdgeInsets), touchPoint); 216 | BOOL touchesUpperHandler = CGRectContainsPoint(UIEdgeInsetsInsetRect(self.upperHandler.frame, self.touchEdgeInsets), touchPoint); 217 | 218 | if (touchesLowerHandler && !touchesUpperHandler) { 219 | targetHandler = BMARangeSliderHandlerLower; 220 | } else if (touchesUpperHandler && !touchesLowerHandler) { 221 | targetHandler = BMARangeSliderHandlerUpper; 222 | } else if (touchesLowerHandler && touchesUpperHandler) { 223 | if ([self normFromPoint:touchPoint toPoint:self.lowerHandler.center] < [self normFromPoint:touchPoint toPoint:self.upperHandler.center]) { 224 | targetHandler = BMARangeSliderHandlerLower; 225 | } else { 226 | targetHandler = BMARangeSliderHandlerUpper; 227 | } 228 | } 229 | 230 | return targetHandler; 231 | } 232 | 233 | - (CGFloat)normFromPoint:(CGPoint)p1 toPoint:(CGPoint)p2 { 234 | CGFloat vx = p2.x - p1.x; 235 | CGFloat vy = p2.y - p1.y; 236 | return vx * vx + vy * vy; 237 | } 238 | 239 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 240 | if (!self.lowerHandler.highlighted && !self.upperHandler.highlighted) { 241 | return YES; 242 | } 243 | 244 | CGPoint touchPoint = [touch locationInView:self.slidingView]; 245 | CGFloat newValue = (touchPoint.x / [self rangeWidth]) * (self.maximumValue - self.minimumValue) + self.minimumValue; 246 | 247 | if (self.lowerHandler.highlighted) { 248 | [self setLowerBound:newValue animated:YES]; 249 | if (!self.isOverflow) 250 | [self setUpperBound:MAX(_currentUpperValue, self.currentLowerValue + self.minimumDistance) animated:YES]; 251 | } else if (self.upperHandler.highlighted) { 252 | [self setUpperBound:newValue animated:YES]; 253 | [self setLowerBound:MIN(_currentLowerValue, self.currentUpperValue - self.minimumDistance) animated:YES]; 254 | } 255 | 256 | if (self.continuous) { 257 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 258 | } 259 | 260 | [self setNeedsLayout]; 261 | 262 | return YES; 263 | } 264 | 265 | - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 266 | self.lowerHandler.highlighted = NO; 267 | self.upperHandler.highlighted = NO; 268 | 269 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 270 | [self sendActionsForControlEvents:UIControlEventEditingDidEnd]; 271 | } 272 | 273 | #pragma mark - Styling 274 | 275 | - (UIImage *)unselectedLineImage { 276 | return [self.style unselectedLineImage]; 277 | } 278 | 279 | - (UIImage *)selectedLineImage { 280 | return [self.style selectedLineImage]; 281 | } 282 | 283 | - (UIImage *)handlerImage { 284 | return [self.style handlerImage]; 285 | } 286 | 287 | - (CGFloat)lineHeight { 288 | return [self unselectedLineImage].size.height; 289 | } 290 | 291 | #pragma mark - Convenience accessors 292 | - (CGFloat)rangeWidth { 293 | return self.slidingView.bounds.size.width; 294 | } 295 | 296 | #pragma mark - Setters 297 | 298 | - (void)setCurrentLowerValue:(CGFloat)value { 299 | [self setLowerBound:value animated:NO]; 300 | } 301 | 302 | - (void)setLowerBound:(CGFloat)value animated:(BOOL)animated { 303 | [self executeBlock:^{ 304 | self.underflow = value < [self underflowThresholdValue]; 305 | _currentLowerValue = [self sanitizeValue:value withAdditionalMinimum:0. additionalMaximum:self.minimumDistance]; 306 | 307 | if (_currentLowerValue > self.currentUpperValue) { 308 | self.currentUpperValue = _currentLowerValue; 309 | } 310 | } animated:animated]; 311 | } 312 | 313 | - (void)setCurrentUpperValue:(CGFloat)value { 314 | [self setUpperBound:value animated:NO]; 315 | } 316 | 317 | - (void)setUpperBound:(CGFloat)value animated:(BOOL)animated { 318 | [self executeBlock:^{ 319 | self.overflow = value > [self overflowThresholdValue]; 320 | _currentUpperValue = [self sanitizeValue:value withAdditionalMinimum:self.minimumDistance additionalMaximum:0.]; 321 | if (_currentUpperValue < self.currentLowerValue) { 322 | self.currentLowerValue = _currentUpperValue; 323 | } 324 | } animated:animated]; 325 | } 326 | 327 | - (void)executeBlock:(void (^)(void))block animated:(BOOL)animated { 328 | if (animated) { 329 | [UIView animateWithDuration:[self animationDuration] 330 | delay:0.0 331 | options:UIViewAnimationOptionBeginFromCurrentState 332 | animations:^{ 333 | block(); 334 | [self updateUI]; 335 | } 336 | completion:nil]; 337 | } else { 338 | block(); 339 | [self setNeedsLayout]; 340 | } 341 | } 342 | 343 | - (CGFloat)sanitizeValue:(CGFloat)value withAdditionalMinimum:(CGFloat)additionalMinimum additionalMaximum:(CGFloat)additionalMaximum { 344 | value = [self stepValue:value]; 345 | value = MIN(value, self.maximumValue - additionalMaximum); 346 | value = MAX(value, self.minimumValue + additionalMinimum); 347 | return value; 348 | } 349 | 350 | - (CGFloat)stepValue:(CGFloat)value { 351 | if (self.step > 0.) { 352 | CGFloat lowerSteppedValue = (CGFloat)floor((value - self.minimumValue) / self.step) * self.step + self.minimumValue; 353 | CGFloat upperSteppedValue = lowerSteppedValue + self.step; 354 | value = (value - lowerSteppedValue < upperSteppedValue - value) ? lowerSteppedValue : upperSteppedValue; 355 | } 356 | return value; 357 | } 358 | 359 | - (void)setMaximumValue:(CGFloat)maximumValue { 360 | _maximumValue = maximumValue; 361 | [self setNeedsLayout]; 362 | } 363 | 364 | - (void)setMinimumValue:(CGFloat)minimumValue { 365 | _minimumValue = minimumValue; 366 | [self setNeedsLayout]; 367 | } 368 | 369 | - (NSTimeInterval)animationDuration { 370 | return 0.10; 371 | } 372 | 373 | - (UIEdgeInsets)touchEdgeInsets { 374 | return UIEdgeInsetsMake(-10., -10., -10., -10.); 375 | } 376 | 377 | - (UIEdgeInsets)slidingViewEdgeInsets { 378 | // Make handlers to be tangential with end of background. 379 | 380 | return UIEdgeInsetsMake(0., (self.lowerHandler.bounds.size.width / 2.) - 1., 0., (self.lowerHandler.bounds.size.width / 2.) - 1.); 381 | } 382 | 383 | - (CGFloat)overflowThresholdValue { 384 | CGFloat thresholdValue = self.maximumValue + [self overflowDistance] * (self.maximumValue - self.minimumValue) / [self rangeWidth]; 385 | 386 | if (!isfinite(thresholdValue)) { 387 | thresholdValue = self.maximumValue; 388 | } 389 | 390 | return thresholdValue; 391 | } 392 | 393 | - (CGFloat)underflowThresholdValue { 394 | CGFloat thresholdValue = self.minimumValue - [self overflowDistance] * (self.maximumValue - self.minimumValue) / [self rangeWidth]; 395 | 396 | return thresholdValue; 397 | } 398 | 399 | - (CGFloat)overflowDistance { 400 | return 20.; 401 | } 402 | 403 | - (void)updateView:(UIView *)view frameChange:(void (^)(CGRect *frame))frameChange { 404 | CGRect frame = view.frame; 405 | frameChange(&frame); 406 | view.frame = frame; 407 | } 408 | 409 | @end 410 | -------------------------------------------------------------------------------- /Component/Classes/BMASlider.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | #import "BMASliderStyling.h" 27 | 28 | @protocol BMASlider 29 | 30 | @property (nonatomic) id style; 31 | @property (nonatomic) CGFloat minimumValue; 32 | @property (nonatomic) CGFloat maximumValue; 33 | @property (nonatomic) CGFloat currentValue; 34 | 35 | /** 36 | * if YES, indicates the user is (significantly) touching beyond the maximumValue 37 | */ 38 | @property (nonatomic, readonly, getter=isOverflow) BOOL overflow; 39 | 40 | - (void)setCurrentValue:(CGFloat)value animated:(BOOL)animated; 41 | 42 | /** 43 | * if > 0, values are discretized as k*Step. 44 | */ 45 | @property (nonatomic) CGFloat step; 46 | 47 | /** 48 | * if NO, notifies of changes once user finish interaction. Default is YES 49 | */ 50 | @property (nonatomic, getter=isContinuous) BOOL continuous; 51 | 52 | @end 53 | 54 | IB_DESIGNABLE 55 | @interface BMASlider : UIControl 56 | 57 | @property (nonatomic) id style UI_APPEARANCE_SELECTOR; // Default is BMASliderLiveRenderingStyle 58 | @property (nonatomic) IBInspectable CGFloat minimumValue; 59 | @property (nonatomic) IBInspectable CGFloat maximumValue; 60 | @property (nonatomic) IBInspectable CGFloat currentValue; 61 | @property (nonatomic) IBInspectable CGFloat step; 62 | @property (nonatomic, getter=isContinuous) IBInspectable BOOL continuous; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Component/Classes/BMASlider.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMASlider.h" 26 | #import "BMASliderLiveRenderingStyle.h" 27 | 28 | @interface BMASlider () 29 | 30 | @property (nonatomic, strong) UIView *slidingView; 31 | @property (nonatomic, strong) UIImageView *selectedRangeImageView; 32 | @property (nonatomic, strong) UIImageView *backgroundRangeImageView; 33 | @property (nonatomic, strong) UIImageView *handler; 34 | @property (nonatomic) UIEdgeInsets touchEdgeInsets; 35 | @property (nonatomic, readwrite, getter=isOverflow) BOOL overflow; 36 | 37 | @end 38 | 39 | @implementation BMASlider 40 | 41 | - (instancetype)init { 42 | self = [super init]; 43 | if (self) { 44 | [self commonInit]; 45 | } 46 | return self; 47 | } 48 | 49 | - (instancetype)initWithFrame:(CGRect)frame { 50 | self = [super initWithFrame:frame]; 51 | if (self) { 52 | [self commonInit]; 53 | } 54 | return self; 55 | } 56 | 57 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 58 | self = [super initWithCoder:aDecoder]; 59 | if (self) { 60 | [self commonInit]; 61 | } 62 | return self; 63 | } 64 | 65 | - (void)commonInit { 66 | [self setUpDefaultStyle]; 67 | [self setUpDefaultValues]; 68 | [self setUpViews]; 69 | } 70 | 71 | - (void)setUpDefaultStyle { 72 | _style = [[BMASliderLiveRenderingStyle alloc] init]; 73 | } 74 | 75 | - (void)setUpDefaultValues { 76 | _continuous = YES; 77 | _minimumValue = 0.; 78 | _maximumValue = 100.; 79 | _currentValue = 50.; 80 | } 81 | 82 | - (void)setUpViews { 83 | self.backgroundColor = [UIColor clearColor]; 84 | CGPoint center = CGPointMake(self.bounds.size.width / 2., self.bounds.size.height / 2.); 85 | 86 | _handler = [[UIImageView alloc] init]; 87 | _handler.center = center; 88 | 89 | _backgroundRangeImageView = [[UIImageView alloc] init]; 90 | [self updateView:_backgroundRangeImageView frameChange:^(CGRect *frame) { 91 | frame->size.width = self.bounds.size.width; 92 | }]; 93 | _backgroundRangeImageView.center = center; 94 | _backgroundRangeImageView.frame = CGRectIntegral(_backgroundRangeImageView.frame); 95 | _backgroundRangeImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 96 | 97 | _slidingView = [[UIView alloc] init]; 98 | _slidingView.userInteractionEnabled = NO; 99 | 100 | _selectedRangeImageView = [[UIImageView alloc] init]; 101 | _selectedRangeImageView.center = CGPointMake(0, center.y); 102 | _selectedRangeImageView.frame = CGRectIntegral(_selectedRangeImageView.frame); 103 | _selectedRangeImageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 104 | 105 | [self addSubview:self.slidingView]; 106 | [self addSubview:self.backgroundRangeImageView]; 107 | [self addSubview:self.selectedRangeImageView]; 108 | [self addSubview:self.handler]; 109 | 110 | [self updateStyle]; 111 | } 112 | 113 | - (void)setStyle:(id)style { 114 | _style = style; 115 | [self updateStyle]; 116 | } 117 | 118 | - (void)updateStyle { 119 | self.handler.image = [self handlerImage]; 120 | self.backgroundRangeImageView.image = [self unselectedLineImage]; 121 | self.selectedRangeImageView.image = [self selectedLineImage]; 122 | 123 | [self updateView:self.handler frameChange:^(CGRect *frame) { 124 | frame->size = [self handlerImage].size; 125 | }]; 126 | 127 | [self updateView:self.selectedRangeImageView frameChange:^(CGRect *frame) { 128 | frame->size.height = [self lineHeight]; 129 | }]; 130 | 131 | [self updateView:self.backgroundRangeImageView frameChange:^(CGRect *frame) { 132 | frame->size.height = [self lineHeight]; 133 | }]; 134 | } 135 | 136 | - (void)layoutSubviews { 137 | [super layoutSubviews]; 138 | [self updateUI]; 139 | } 140 | 141 | - (void)updateUI { 142 | [self updateSlidingView]; 143 | [self updateSelectedRange]; 144 | [self placeHandler]; 145 | } 146 | 147 | - (void)updateSlidingView { 148 | self.slidingView.frame = UIEdgeInsetsInsetRect(_backgroundRangeImageView.frame, [self slidingViewEdgeInsets]); 149 | } 150 | 151 | - (void)updateSelectedRange { 152 | CGFloat width = [self selectedRangeNormalizedLength] * self.backgroundRangeImageView.bounds.size.width; 153 | [self updateView:self.selectedRangeImageView frameChange:^(CGRect *frame) { 154 | frame->size.width = width; 155 | }]; 156 | } 157 | 158 | - (void)placeHandler { 159 | CGFloat centerX = self.slidingView.frame.origin.x + [self selectedRangeNormalizedLength] * self.slidingView.bounds.size.width; 160 | self.handler.center = CGPointMake(centerX, self.backgroundRangeImageView.center.y); 161 | } 162 | 163 | #pragma mark - Convenience accessors 164 | 165 | - (CGFloat)selectedRangeNormalizedLength { 166 | return (self.currentValue - self.minimumValue) / (self.maximumValue - self.minimumValue); 167 | } 168 | 169 | #pragma mark - User interaction 170 | 171 | - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 172 | CGPoint touchPoint = [touch locationInView:self]; 173 | 174 | if (CGRectContainsPoint(UIEdgeInsetsInsetRect(self.handler.frame, self.touchEdgeInsets), touchPoint)) { 175 | self.handler.highlighted = YES; 176 | } 177 | 178 | return YES; 179 | } 180 | 181 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 182 | if (!self.handler.highlighted) { 183 | return YES; 184 | } 185 | 186 | CGPoint touchPoint = [touch locationInView:self.slidingView]; 187 | CGFloat newValue = (touchPoint.x / [self rangeWidth]) * (self.maximumValue - self.minimumValue) + self.minimumValue; 188 | 189 | if (self.handler.highlighted) { 190 | [self setCurrentValue:newValue animated:YES]; 191 | } 192 | 193 | if (self.continuous) { 194 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 195 | } 196 | 197 | [self setNeedsLayout]; 198 | 199 | return YES; 200 | } 201 | 202 | - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 203 | self.handler.highlighted = NO; 204 | 205 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 206 | [self sendActionsForControlEvents:UIControlEventEditingDidEnd]; 207 | } 208 | 209 | #pragma mark - Styling 210 | 211 | - (UIImage *)unselectedLineImage { 212 | return [self.style unselectedLineImage]; 213 | } 214 | 215 | - (UIImage *)selectedLineImage { 216 | return [self.style selectedLineImage]; 217 | } 218 | 219 | - (UIImage *)handlerImage { 220 | return [self.style handlerImage]; 221 | } 222 | 223 | - (CGFloat)lineHeight { 224 | return [self unselectedLineImage].size.height; 225 | } 226 | 227 | #pragma mark - Convenience accessors 228 | - (CGFloat)rangeWidth { 229 | return self.slidingView.bounds.size.width; 230 | } 231 | 232 | #pragma mark - Setters 233 | 234 | - (void)setCurrentValue:(CGFloat)value { 235 | [self setCurrentValue:value animated:NO]; 236 | } 237 | 238 | - (void)setCurrentValue:(CGFloat)value animated:(BOOL)animated { 239 | [self executeBlock:^{ 240 | self.overflow = value > [self overflowThresholdValue]; 241 | _currentValue = [self sanitizeValue:value]; 242 | } animated:animated]; 243 | } 244 | 245 | - (void)executeBlock:(void (^)(void))block animated:(BOOL)animated { 246 | if (animated) { 247 | [UIView animateWithDuration:[self animationDuration] 248 | delay:0.0 249 | options:UIViewAnimationOptionBeginFromCurrentState 250 | animations:^{ 251 | block(); 252 | [self updateUI]; 253 | } 254 | completion:nil]; 255 | } else { 256 | block(); 257 | [self setNeedsLayout]; 258 | } 259 | } 260 | 261 | - (CGFloat)sanitizeValue:(CGFloat)value { 262 | value = [self stepValue:value]; 263 | value = MIN(value, self.maximumValue); 264 | value = MAX(value, self.minimumValue); 265 | return value; 266 | } 267 | 268 | - (CGFloat)stepValue:(CGFloat)value { 269 | if (self.step > 0.) { 270 | CGFloat lowerSteppedValue = (CGFloat)floor((value - self.minimumValue) / self.step) * self.step + self.minimumValue; 271 | CGFloat upperSteppedValue = lowerSteppedValue + self.step; 272 | value = (value - lowerSteppedValue < upperSteppedValue - value) ? lowerSteppedValue : upperSteppedValue; 273 | } 274 | return value; 275 | } 276 | 277 | - (void)setMaximumValue:(CGFloat)maximumValue { 278 | _maximumValue = maximumValue; 279 | [self setNeedsLayout]; 280 | } 281 | 282 | - (void)setMinimumValue:(CGFloat)minimumValue { 283 | _minimumValue = minimumValue; 284 | [self setNeedsLayout]; 285 | } 286 | 287 | - (NSTimeInterval)animationDuration { 288 | return 0.10; 289 | } 290 | 291 | - (UIEdgeInsets)touchEdgeInsets { 292 | return UIEdgeInsetsMake(-10., -10., -10., -10.); 293 | } 294 | 295 | - (UIEdgeInsets)slidingViewEdgeInsets { 296 | // Make handler to be tangential with end of background. 297 | return UIEdgeInsetsMake(0., (self.handler.bounds.size.width / 2.) - 1., 0., (self.handler.bounds.size.width / 2.) - 1.); 298 | } 299 | 300 | - (CGFloat)overflowThresholdValue { 301 | CGFloat thresholdValue = self.maximumValue + [self overflowDistance] * (self.maximumValue - self.minimumValue) / [self rangeWidth]; 302 | 303 | return thresholdValue; 304 | } 305 | 306 | - (CGFloat)underflowThresholdValue { 307 | CGFloat thresholdValue = self.minimumValue - [self overflowDistance] * (self.maximumValue - self.minimumValue) / [self rangeWidth]; 308 | 309 | return thresholdValue; 310 | } 311 | 312 | - (CGFloat)overflowDistance { 313 | return 20.; 314 | } 315 | 316 | - (void)updateView:(UIView *)view frameChange:(void (^)(CGRect *frame))frameChange { 317 | CGRect frame = view.frame; 318 | frameChange(&frame); 319 | view.frame = frame; 320 | } 321 | 322 | @end 323 | -------------------------------------------------------------------------------- /Component/Classes/BMASliderLiveRenderingStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import Foundation; 26 | #import "BMASliderStyling.h" 27 | 28 | @interface BMASliderLiveRenderingStyle : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Component/Classes/BMASliderLiveRenderingStyle.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMASliderLiveRenderingStyle.h" 26 | 27 | @implementation BMASliderLiveRenderingStyle 28 | 29 | - (UIImage *)unselectedLineImage { 30 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(3., 2.), NO, [[UIScreen mainScreen] scale]); 31 | 32 | UIBezierPath *rectanglePath = [UIBezierPath bezierPathWithRect:CGRectMake(0., 0., 3., 2.)]; 33 | 34 | [UIColor.grayColor setFill]; 35 | [rectanglePath fill]; 36 | 37 | UIImage *thumbnail = UIGraphicsGetImageFromCurrentImageContext(); 38 | UIGraphicsEndImageContext(); 39 | 40 | return [thumbnail resizableImageWithCapInsets:UIEdgeInsetsMake(0., 1., 0., 1.) resizingMode:UIImageResizingModeStretch]; 41 | } 42 | 43 | - (UIImage *)selectedLineImage { 44 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(3., 2.), NO, [[UIScreen mainScreen] scale]); 45 | 46 | UIBezierPath *rectanglePath = [UIBezierPath bezierPathWithRect:CGRectMake(0., 0., 3., 2.)]; 47 | [UIColor.redColor setFill]; 48 | [rectanglePath fill]; 49 | 50 | UIImage *thumbnail = UIGraphicsGetImageFromCurrentImageContext(); 51 | UIGraphicsEndImageContext(); 52 | 53 | return [thumbnail resizableImageWithCapInsets:UIEdgeInsetsMake(0., 1., 0., 1.) resizingMode:UIImageResizingModeStretch]; 54 | } 55 | 56 | - (UIImage *)handlerImage { 57 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(28., 28.), NO, [[UIScreen mainScreen] scale]); 58 | UIColor *color = [UIColor redColor]; 59 | 60 | UIBezierPath *ovalPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0., 0., 28., 28.)]; 61 | [color setFill]; 62 | [ovalPath fill]; 63 | 64 | UIImage *thumbnail = UIGraphicsGetImageFromCurrentImageContext(); 65 | UIGraphicsEndImageContext(); 66 | return thumbnail; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Component/Classes/BMASliderReusableXibControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | 27 | /** 28 | * Allows to reuse in XIBs / storyboards 29 | */ 30 | @interface BMASliderReusableXibControl : UIControl 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Component/Classes/BMASliderReusableXibControl.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMASliderReusableXibControl.h" 26 | 27 | @implementation BMASliderReusableXibControl 28 | 29 | - (instancetype)init { 30 | self = [super init]; 31 | if (self) { 32 | self = [[[NSBundle bundleForClass:[self class]] loadNibNamed:NSStringFromClass([self class]) 33 | owner:self 34 | options:nil] firstObject]; 35 | } 36 | return self; 37 | } 38 | 39 | - (instancetype)initWithFrame:(CGRect)frame { 40 | self = [super initWithFrame:frame]; 41 | if (self) { 42 | self = [[[NSBundle bundleForClass:[self class]] loadNibNamed:NSStringFromClass([self class]) 43 | owner:self 44 | options:nil] firstObject]; 45 | self.frame = frame; 46 | } 47 | return self; 48 | } 49 | 50 | /** 51 | * Check: http://cocoanuts.mobi/2014/03/26/reusable/ 52 | */ 53 | - (instancetype)awakeAfterUsingCoder:(NSCoder *)aDecoder { 54 | if ([self.subviews count] > 0) { 55 | return self; 56 | } 57 | 58 | NSBundle *mainBundle = [NSBundle bundleForClass:[self class]]; 59 | NSArray *loadedViews = [mainBundle loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil]; 60 | UIView *loadedView = [loadedViews firstObject]; 61 | 62 | loadedView.frame = self.frame; 63 | loadedView.autoresizingMask = self.autoresizingMask; 64 | loadedView.translatesAutoresizingMaskIntoConstraints = self.translatesAutoresizingMaskIntoConstraints; 65 | 66 | for (NSLayoutConstraint *constraint in self.constraints) { 67 | id firstItem = constraint.firstItem == self ? loadedView : constraint.firstItem; 68 | id secondItem = constraint.secondItem == self ? loadedView : constraint.secondItem; 69 | [loadedView addConstraint:[NSLayoutConstraint constraintWithItem:firstItem 70 | attribute:constraint.firstAttribute 71 | relatedBy:constraint.relation 72 | toItem:secondItem 73 | attribute:constraint.secondAttribute 74 | multiplier:constraint.multiplier 75 | constant:constraint.constant]]; 76 | } 77 | 78 | return (id)loadedView; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Component/Classes/BMASliderStyling.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import Foundation; 26 | @import UIKit; 27 | 28 | @protocol BMASliderStyling 29 | 30 | - (UIImage *)unselectedLineImage; 31 | - (UIImage *)selectedLineImage; 32 | - (UIImage *)handlerImage; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Component/Resources/BMALabeledRangeSlider.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 | 47 | 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 | -------------------------------------------------------------------------------- /Component/Resources/BMALabeledSlider.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 | 44 | 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 | -------------------------------------------------------------------------------- /Example/BMASlidersExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1FD3091078C173C91141D710 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DFBD565EF65E9FF11A1B340 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 11 | C3DA507E1A8157030023F45F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA507D1A8157030023F45F /* main.m */; }; 12 | C3DA50811A8157030023F45F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50801A8157030023F45F /* AppDelegate.m */; }; 13 | C3DA50841A8157030023F45F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50831A8157030023F45F /* ViewController.m */; }; 14 | C3DA50871A8157030023F45F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3DA50851A8157030023F45F /* Main.storyboard */; }; 15 | C3DA50891A8157030023F45F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3DA50881A8157030023F45F /* Images.xcassets */; }; 16 | C3DA508C1A8157030023F45F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3DA508A1A8157030023F45F /* LaunchScreen.xib */; }; 17 | C3DA50A41A8161160023F45F /* BMALabeledSliderConfigurator.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50A31A8161160023F45F /* BMALabeledSliderConfigurator.m */; }; 18 | C3DA50A91A8161330023F45F /* BMARangeFormatterDistance.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50A61A8161330023F45F /* BMARangeFormatterDistance.m */; }; 19 | C3DA50AA1A8161330023F45F /* BMARangeFormatterInteger.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50A81A8161330023F45F /* BMARangeFormatterInteger.m */; }; 20 | C3DA50AD1A81616F0023F45F /* BMASliderDefaultStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA50AC1A81616F0023F45F /* BMASliderDefaultStyle.m */; }; 21 | C3DA50AF1A8162110023F45F /* SliderAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3DA50AE1A8162110023F45F /* SliderAssets.xcassets */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 3DFBD565EF65E9FF11A1B340 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | C3DA50781A8157030023F45F /* BMASlidersExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BMASlidersExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | C3DA507C1A8157030023F45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | C3DA507D1A8157030023F45F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | C3DA507F1A8157030023F45F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | C3DA50801A8157030023F45F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | C3DA50821A8157030023F45F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | C3DA50831A8157030023F45F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | C3DA50861A8157030023F45F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | C3DA50881A8157030023F45F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 35 | C3DA508B1A8157030023F45F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 36 | C3DA50A21A8161160023F45F /* BMALabeledSliderConfigurator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMALabeledSliderConfigurator.h; sourceTree = ""; }; 37 | C3DA50A31A8161160023F45F /* BMALabeledSliderConfigurator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMALabeledSliderConfigurator.m; sourceTree = ""; }; 38 | C3DA50A51A8161330023F45F /* BMARangeFormatterDistance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMARangeFormatterDistance.h; sourceTree = ""; }; 39 | C3DA50A61A8161330023F45F /* BMARangeFormatterDistance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMARangeFormatterDistance.m; sourceTree = ""; }; 40 | C3DA50A71A8161330023F45F /* BMARangeFormatterInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMARangeFormatterInteger.h; sourceTree = ""; }; 41 | C3DA50A81A8161330023F45F /* BMARangeFormatterInteger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMARangeFormatterInteger.m; sourceTree = ""; }; 42 | C3DA50AB1A81616F0023F45F /* BMASliderDefaultStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMASliderDefaultStyle.h; sourceTree = ""; }; 43 | C3DA50AC1A81616F0023F45F /* BMASliderDefaultStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMASliderDefaultStyle.m; sourceTree = ""; }; 44 | C3DA50AE1A8162110023F45F /* SliderAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = SliderAssets.xcassets; sourceTree = ""; }; 45 | D9E2A8361B79F4C7BCD88880 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 46 | F782F46E87A73F8497F05D70 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | C3DA50751A8157030023F45F /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 1FD3091078C173C91141D710 /* Pods.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 4839C20B4FEED11B7F8D38DB /* Frameworks */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 3DFBD565EF65E9FF11A1B340 /* Pods.framework */, 65 | ); 66 | name = Frameworks; 67 | sourceTree = ""; 68 | }; 69 | 847C6C94DBB341BAB10497A2 /* Pods */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | F782F46E87A73F8497F05D70 /* Pods.debug.xcconfig */, 73 | D9E2A8361B79F4C7BCD88880 /* Pods.release.xcconfig */, 74 | ); 75 | name = Pods; 76 | sourceTree = ""; 77 | }; 78 | C3DA506F1A8157030023F45F = { 79 | isa = PBXGroup; 80 | children = ( 81 | C3DA507A1A8157030023F45F /* BMASlidersExample */, 82 | C3DA50791A8157030023F45F /* Products */, 83 | 847C6C94DBB341BAB10497A2 /* Pods */, 84 | 4839C20B4FEED11B7F8D38DB /* Frameworks */, 85 | ); 86 | sourceTree = ""; 87 | }; 88 | C3DA50791A8157030023F45F /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | C3DA50781A8157030023F45F /* BMASlidersExample.app */, 92 | ); 93 | name = Products; 94 | sourceTree = ""; 95 | }; 96 | C3DA507A1A8157030023F45F /* BMASlidersExample */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | C3DA50A11A8160CF0023F45F /* BMASliderCustomizations */, 100 | C3DA507F1A8157030023F45F /* AppDelegate.h */, 101 | C3DA50801A8157030023F45F /* AppDelegate.m */, 102 | C3DA50821A8157030023F45F /* ViewController.h */, 103 | C3DA50831A8157030023F45F /* ViewController.m */, 104 | C3DA50851A8157030023F45F /* Main.storyboard */, 105 | C3DA50AE1A8162110023F45F /* SliderAssets.xcassets */, 106 | C3DA50881A8157030023F45F /* Images.xcassets */, 107 | C3DA508A1A8157030023F45F /* LaunchScreen.xib */, 108 | C3DA507B1A8157030023F45F /* Supporting Files */, 109 | ); 110 | path = BMASlidersExample; 111 | sourceTree = ""; 112 | }; 113 | C3DA507B1A8157030023F45F /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | C3DA507C1A8157030023F45F /* Info.plist */, 117 | C3DA507D1A8157030023F45F /* main.m */, 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | C3DA50A11A8160CF0023F45F /* BMASliderCustomizations */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | C3DA50A21A8161160023F45F /* BMALabeledSliderConfigurator.h */, 126 | C3DA50A31A8161160023F45F /* BMALabeledSliderConfigurator.m */, 127 | C3DA50A51A8161330023F45F /* BMARangeFormatterDistance.h */, 128 | C3DA50A61A8161330023F45F /* BMARangeFormatterDistance.m */, 129 | C3DA50A71A8161330023F45F /* BMARangeFormatterInteger.h */, 130 | C3DA50A81A8161330023F45F /* BMARangeFormatterInteger.m */, 131 | C3DA50AB1A81616F0023F45F /* BMASliderDefaultStyle.h */, 132 | C3DA50AC1A81616F0023F45F /* BMASliderDefaultStyle.m */, 133 | ); 134 | name = BMASliderCustomizations; 135 | sourceTree = ""; 136 | }; 137 | /* End PBXGroup section */ 138 | 139 | /* Begin PBXNativeTarget section */ 140 | C3DA50771A8157030023F45F /* BMASlidersExample */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = C3DA509B1A8157030023F45F /* Build configuration list for PBXNativeTarget "BMASlidersExample" */; 143 | buildPhases = ( 144 | 60A1024538BEC30D97F3DE2C /* Check Pods Manifest.lock */, 145 | C3DA50741A8157030023F45F /* Sources */, 146 | C3DA50751A8157030023F45F /* Frameworks */, 147 | C3DA50761A8157030023F45F /* Resources */, 148 | 5F73C0BCB391A96D0FCF9627 /* Copy Pods Resources */, 149 | 526B9A5DFAAAD37115F3B47B /* Embed Pods Frameworks */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = BMASlidersExample; 156 | productName = BMASlidersExample; 157 | productReference = C3DA50781A8157030023F45F /* BMASlidersExample.app */; 158 | productType = "com.apple.product-type.application"; 159 | }; 160 | /* End PBXNativeTarget section */ 161 | 162 | /* Begin PBXProject section */ 163 | C3DA50701A8157030023F45F /* Project object */ = { 164 | isa = PBXProject; 165 | attributes = { 166 | LastUpgradeCheck = 0610; 167 | ORGANIZATIONNAME = "Diego Sanchez"; 168 | TargetAttributes = { 169 | C3DA50771A8157030023F45F = { 170 | CreatedOnToolsVersion = 6.1.1; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = C3DA50731A8157030023F45F /* Build configuration list for PBXProject "BMASlidersExample" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = C3DA506F1A8157030023F45F; 183 | productRefGroup = C3DA50791A8157030023F45F /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | C3DA50771A8157030023F45F /* BMASlidersExample */, 188 | ); 189 | }; 190 | /* End PBXProject section */ 191 | 192 | /* Begin PBXResourcesBuildPhase section */ 193 | C3DA50761A8157030023F45F /* Resources */ = { 194 | isa = PBXResourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | C3DA50871A8157030023F45F /* Main.storyboard in Resources */, 198 | C3DA508C1A8157030023F45F /* LaunchScreen.xib in Resources */, 199 | C3DA50891A8157030023F45F /* Images.xcassets in Resources */, 200 | C3DA50AF1A8162110023F45F /* SliderAssets.xcassets in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | /* End PBXResourcesBuildPhase section */ 205 | 206 | /* Begin PBXShellScriptBuildPhase section */ 207 | 526B9A5DFAAAD37115F3B47B /* Embed Pods Frameworks */ = { 208 | isa = PBXShellScriptBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | inputPaths = ( 213 | ); 214 | name = "Embed Pods Frameworks"; 215 | outputPaths = ( 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | shellPath = /bin/sh; 219 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; 220 | showEnvVarsInLog = 0; 221 | }; 222 | 5F73C0BCB391A96D0FCF9627 /* Copy Pods Resources */ = { 223 | isa = PBXShellScriptBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | inputPaths = ( 228 | ); 229 | name = "Copy Pods Resources"; 230 | outputPaths = ( 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | shellPath = /bin/sh; 234 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 235 | showEnvVarsInLog = 0; 236 | }; 237 | 60A1024538BEC30D97F3DE2C /* Check Pods Manifest.lock */ = { 238 | isa = PBXShellScriptBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | inputPaths = ( 243 | ); 244 | name = "Check Pods Manifest.lock"; 245 | outputPaths = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | shellPath = /bin/sh; 249 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 250 | showEnvVarsInLog = 0; 251 | }; 252 | /* End PBXShellScriptBuildPhase section */ 253 | 254 | /* Begin PBXSourcesBuildPhase section */ 255 | C3DA50741A8157030023F45F /* Sources */ = { 256 | isa = PBXSourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | C3DA50A41A8161160023F45F /* BMALabeledSliderConfigurator.m in Sources */, 260 | C3DA50841A8157030023F45F /* ViewController.m in Sources */, 261 | C3DA50A91A8161330023F45F /* BMARangeFormatterDistance.m in Sources */, 262 | C3DA50811A8157030023F45F /* AppDelegate.m in Sources */, 263 | C3DA50AA1A8161330023F45F /* BMARangeFormatterInteger.m in Sources */, 264 | C3DA507E1A8157030023F45F /* main.m in Sources */, 265 | C3DA50AD1A81616F0023F45F /* BMASliderDefaultStyle.m in Sources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXSourcesBuildPhase section */ 270 | 271 | /* Begin PBXVariantGroup section */ 272 | C3DA50851A8157030023F45F /* Main.storyboard */ = { 273 | isa = PBXVariantGroup; 274 | children = ( 275 | C3DA50861A8157030023F45F /* Base */, 276 | ); 277 | name = Main.storyboard; 278 | sourceTree = ""; 279 | }; 280 | C3DA508A1A8157030023F45F /* LaunchScreen.xib */ = { 281 | isa = PBXVariantGroup; 282 | children = ( 283 | C3DA508B1A8157030023F45F /* Base */, 284 | ); 285 | name = LaunchScreen.xib; 286 | sourceTree = ""; 287 | }; 288 | /* End PBXVariantGroup section */ 289 | 290 | /* Begin XCBuildConfiguration section */ 291 | C3DA50991A8157030023F45F /* Debug */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ALWAYS_SEARCH_USER_PATHS = NO; 295 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 296 | CLANG_CXX_LIBRARY = "libc++"; 297 | CLANG_ENABLE_MODULES = YES; 298 | CLANG_ENABLE_OBJC_ARC = YES; 299 | CLANG_WARN_BOOL_CONVERSION = YES; 300 | CLANG_WARN_CONSTANT_CONVERSION = YES; 301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 302 | CLANG_WARN_EMPTY_BODY = YES; 303 | CLANG_WARN_ENUM_CONVERSION = YES; 304 | CLANG_WARN_INT_CONVERSION = YES; 305 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 306 | CLANG_WARN_UNREACHABLE_CODE = YES; 307 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 308 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 309 | COPY_PHASE_STRIP = NO; 310 | ENABLE_STRICT_OBJC_MSGSEND = YES; 311 | GCC_C_LANGUAGE_STANDARD = gnu99; 312 | GCC_DYNAMIC_NO_PIC = NO; 313 | GCC_OPTIMIZATION_LEVEL = 0; 314 | GCC_PREPROCESSOR_DEFINITIONS = ( 315 | "DEBUG=1", 316 | "$(inherited)", 317 | ); 318 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 326 | MTL_ENABLE_DEBUG_INFO = YES; 327 | ONLY_ACTIVE_ARCH = YES; 328 | SDKROOT = iphoneos; 329 | TARGETED_DEVICE_FAMILY = "1,2"; 330 | }; 331 | name = Debug; 332 | }; 333 | C3DA509A1A8157030023F45F /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BOOL_CONVERSION = YES; 342 | CLANG_WARN_CONSTANT_CONVERSION = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_EMPTY_BODY = YES; 345 | CLANG_WARN_ENUM_CONVERSION = YES; 346 | CLANG_WARN_INT_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 351 | COPY_PHASE_STRIP = YES; 352 | ENABLE_NS_ASSERTIONS = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = iphoneos; 364 | TARGETED_DEVICE_FAMILY = "1,2"; 365 | VALIDATE_PRODUCT = YES; 366 | }; 367 | name = Release; 368 | }; 369 | C3DA509C1A8157030023F45F /* Debug */ = { 370 | isa = XCBuildConfiguration; 371 | baseConfigurationReference = F782F46E87A73F8497F05D70 /* Pods.debug.xcconfig */; 372 | buildSettings = { 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | INFOPLIST_FILE = BMASlidersExample/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 376 | PRODUCT_NAME = "$(TARGET_NAME)"; 377 | }; 378 | name = Debug; 379 | }; 380 | C3DA509D1A8157030023F45F /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | baseConfigurationReference = D9E2A8361B79F4C7BCD88880 /* Pods.release.xcconfig */; 383 | buildSettings = { 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | INFOPLIST_FILE = BMASlidersExample/Info.plist; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | C3DA50731A8157030023F45F /* Build configuration list for PBXProject "BMASlidersExample" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | C3DA50991A8157030023F45F /* Debug */, 398 | C3DA509A1A8157030023F45F /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | C3DA509B1A8157030023F45F /* Build configuration list for PBXNativeTarget "BMASlidersExample" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | C3DA509C1A8157030023F45F /* Debug */, 407 | C3DA509D1A8157030023F45F /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | /* End XCConfigurationList section */ 413 | }; 414 | rootObject = C3DA50701A8157030023F45F /* Project object */; 415 | } 416 | -------------------------------------------------------------------------------- /Example/BMASlidersExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/BMASlidersExample.xcodeproj/xcshareddata/xcschemes/BMASlidersExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/BMASlidersExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | 27 | @interface AppDelegate : UIResponder 28 | 29 | @property (strong, nonatomic) UIWindow *window; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "AppDelegate.h" 26 | #import 27 | #import 28 | #import "BMASliderDefaultStyle.h" 29 | 30 | @interface AppDelegate () 31 | 32 | @end 33 | 34 | @implementation AppDelegate 35 | 36 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 37 | [BMASlider appearance].style = [[BMASliderDefaultStyle alloc] init]; 38 | [BMARangeSlider appearance].style = [[BMASliderDefaultStyle alloc] init]; 39 | return YES; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMALabeledSliderConfigurator.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import Foundation; 26 | #import 27 | 28 | typedef NS_ENUM(NSUInteger, BMALabeledSliderType) { 29 | BMALabeledSliderTypeAge, 30 | BMALabeledSliderTypeDistance, 31 | }; 32 | 33 | @interface BMALabeledSliderConfigurator : NSObject 34 | 35 | + (void)configureSlider:(id)labeledSlider 36 | style:(BMALabeledSliderType)style; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMALabeledSliderConfigurator.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMALabeledSliderConfigurator.h" 26 | #import "BMARangeFormatterInteger.h" 27 | #import "BMARangeFormatterDistance.h" 28 | 29 | @implementation BMALabeledSliderConfigurator 30 | 31 | + (void)configureSlider:(id)labeledSlider 32 | style:(BMALabeledSliderType)sliderType { 33 | labeledSlider.title = [self titleForStyle:sliderType]; 34 | labeledSlider.rangeFormatter = [self rangeFormatterForStyle:sliderType]; 35 | } 36 | 37 | + (id)rangeFormatterForStyle: 38 | (BMALabeledSliderType)sliderType { 39 | switch (sliderType) { 40 | case BMALabeledSliderTypeAge: 41 | return [[BMARangeFormatterInteger alloc] init]; 42 | case BMALabeledSliderTypeDistance: 43 | return [[BMARangeFormatterDistance alloc] init]; 44 | } 45 | 46 | NSAssert(NO, @"Unknown type"); 47 | return nil; 48 | } 49 | 50 | + (NSAttributedString *)titleForStyle:(BMALabeledSliderType)sliderType { 51 | switch (sliderType) { 52 | case BMALabeledSliderTypeAge: 53 | return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Age", nil)]; 54 | case BMALabeledSliderTypeDistance: 55 | return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Distance", nil)]; 56 | } 57 | NSAssert(NO, @"Unknown type"); 58 | return nil; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMARangeFormatterDistance.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | @import Foundation; 25 | #import 26 | 27 | typedef NS_ENUM(NSUInteger, BMADistanceUnit) { 28 | BMADistanceUnitDefault, 29 | BMADistanceUnitMetric, 30 | BMADistanceUnitImperial, 31 | }; 32 | 33 | @interface BMARangeFormatterDistance : NSObject 34 | 35 | @property (nonatomic) BMADistanceUnit distanceUnit; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMARangeFormatterDistance.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMARangeFormatterDistance.h" 26 | 27 | @implementation BMARangeFormatterDistance 28 | @synthesize hasLowerValue; 29 | @synthesize lowerValue; 30 | @synthesize upperValue; 31 | @synthesize overflow; 32 | 33 | - (BMADistanceUnit)distanceUnit { 34 | if (_distanceUnit == BMADistanceUnitDefault) { 35 | NSLocale *locale = [NSLocale currentLocale]; 36 | BOOL isMetric = [[locale objectForKey:NSLocaleUsesMetricSystem] boolValue]; 37 | _distanceUnit = isMetric ? BMADistanceUnitMetric : BMADistanceUnitImperial; 38 | } 39 | return _distanceUnit; 40 | } 41 | 42 | - (NSString *)distanceUnitString { 43 | switch (self.distanceUnit) { 44 | case BMADistanceUnitDefault: 45 | NSAssert(NO, @"Should not reach this"); 46 | break; 47 | case BMADistanceUnitMetric: 48 | return NSLocalizedString(@"Km", nil); 49 | break; 50 | 51 | case BMADistanceUnitImperial: 52 | return NSLocalizedString(@"mi", nil); 53 | break; 54 | } 55 | return nil; 56 | } 57 | 58 | - (NSAttributedString *)formattedString { 59 | return [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", @(self.upperValue), [self distanceUnitString]]]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMARangeFormatterInteger.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | @import Foundation; 25 | #import 26 | 27 | @interface BMARangeFormatterInteger : NSObject 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMARangeFormatterInteger.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMARangeFormatterInteger.h" 26 | 27 | @implementation BMARangeFormatterInteger 28 | @synthesize hasLowerValue; 29 | @synthesize lowerValue; 30 | @synthesize upperValue; 31 | @synthesize overflow; 32 | 33 | - (NSAttributedString *)formattedString { 34 | NSString *overflowString = [self isOverflow] ? @"+" : @""; 35 | NSString *formattedString = [NSString stringWithFormat:@"%ld-%ld%@", (long)[@(self.lowerValue) integerValue], (long)[@(self.upperValue) integerValue], overflowString]; 36 | return [[NSAttributedString alloc] initWithString:formattedString]; 37 | } 38 | @end 39 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMASliderDefaultStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import Foundation; 26 | #import 27 | 28 | @interface BMASliderDefaultStyle : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/BMASliderDefaultStyle.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BMASliderDefaultStyle.h" 26 | 27 | @implementation BMASliderDefaultStyle 28 | 29 | - (UIImage *)unselectedLineImage { 30 | return [UIImage imageNamed:@"range_slider_unselected_background" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil]; 31 | } 32 | 33 | - (UIImage *)selectedLineImage { 34 | return [UIImage imageNamed:@"range_slider_selected_background" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil]; 35 | } 36 | 37 | - (UIImage *)handlerImage { 38 | return [UIImage imageNamed:@"range_slider_handler" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/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 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 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 | 123 | 129 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/BMASlidersExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.badoo.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_handler.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "range_slider_handler.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_handler.imageset/range_slider_handler.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/Example/BMASlidersExample/SliderAssets.xcassets/range_slider_handler.imageset/range_slider_handler.pdf -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_selected_background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "range_slider_selected_background.pdf", 6 | "resizing" : { 7 | "mode" : "3-part-horizontal", 8 | "center" : { 9 | "mode" : "stretch", 10 | "width" : 1 11 | }, 12 | "capInsets" : { 13 | "right" : 1, 14 | "left" : 1 15 | } 16 | } 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_selected_background.imageset/range_slider_selected_background.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/Example/BMASlidersExample/SliderAssets.xcassets/range_slider_selected_background.imageset/range_slider_selected_background.pdf -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_unselected_background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "range_slide_unselected_background.pdf", 6 | "resizing" : { 7 | "mode" : "3-part-horizontal", 8 | "center" : { 9 | "mode" : "stretch", 10 | "width" : 1 11 | }, 12 | "capInsets" : { 13 | "right" : 1, 14 | "left" : 1 15 | } 16 | } 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/BMASlidersExample/SliderAssets.xcassets/range_slider_unselected_background.imageset/range_slide_unselected_background.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/Example/BMASlidersExample/SliderAssets.xcassets/range_slider_unselected_background.imageset/range_slide_unselected_background.pdf -------------------------------------------------------------------------------- /Example/BMASlidersExample/ViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | 27 | @interface ViewController : UIViewController 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/ViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ViewController.h" 26 | #import "BMALabeledSliderConfigurator.h" 27 | #import 28 | #import 29 | #import 30 | 31 | @interface ViewController () 32 | @property (nonatomic, retain) IBOutletCollection(UIView) NSArray *containers; 33 | @property (weak, nonatomic) IBOutlet BMALabeledRangeSlider *labeledRangeSlider; 34 | @property (weak, nonatomic) IBOutlet BMALabeledSlider *labeledSlider; 35 | @property (weak, nonatomic) IBOutlet BMARangeSlider *rangeSlider; 36 | @property (weak, nonatomic) IBOutlet BMASlider *slider; 37 | @property (weak, nonatomic) IBOutlet UILabel *rangeSliderLabel; 38 | @property (weak, nonatomic) IBOutlet UILabel *sliderLabel; 39 | 40 | @end 41 | 42 | @implementation ViewController 43 | 44 | - (void)viewDidLoad { 45 | [super viewDidLoad]; 46 | [self configureContainers]; 47 | [self configureSliders]; 48 | } 49 | 50 | - (void)configureContainers { 51 | for (UIView *view in self.containers) { 52 | view.layer.cornerRadius = 5.; 53 | view.layer.borderWidth = 1.; 54 | view.layer.borderColor = [UIColor grayColor].CGColor; 55 | } 56 | } 57 | 58 | - (void)configureSliders { 59 | [BMALabeledSliderConfigurator configureSlider:self.labeledRangeSlider 60 | style:BMALabeledSliderTypeAge]; 61 | [BMALabeledSliderConfigurator configureSlider:self.labeledSlider 62 | style:BMALabeledSliderTypeDistance]; 63 | self.rangeSlider.style = [[BMASliderLiveRenderingStyle alloc] init]; 64 | [self updateRangeSliderLabel]; 65 | [self updateSliderLabel]; 66 | } 67 | 68 | - (IBAction)rangeSliderDidChangeValue:(BMARangeSlider *)sender { 69 | [self updateRangeSliderLabel]; 70 | } 71 | 72 | - (void)updateRangeSliderLabel { 73 | self.rangeSliderLabel.text = [NSString stringWithFormat:@"%@-%@", @(self.rangeSlider.currentLowerValue), @(self.rangeSlider.currentUpperValue)]; 74 | } 75 | 76 | - (IBAction)sliderDidChangeValue:(id)sender { 77 | [self updateSliderLabel]; 78 | } 79 | 80 | - (void)updateSliderLabel { 81 | self.sliderLabel.text = [NSString stringWithFormat:@"%@", @(self.slider.currentValue)]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Example/BMASlidersExample/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @import UIKit; 26 | #import "AppDelegate.h" 27 | 28 | int main(int argc, char *argv[]) { 29 | @autoreleasepool { 30 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | use_frameworks! 4 | pod 'BMASliders', :path => '..' 5 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BMASliders (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - BMASliders (from `..`) 6 | 7 | EXTERNAL SOURCES: 8 | BMASliders: 9 | :path: .. 10 | 11 | SPEC CHECKSUMS: 12 | BMASliders: b623bb2e3ff891a5a33cffadec769ffcfcd9ad2c 13 | 14 | COCOAPODS: 0.36.0.rc.1 15 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMALabeledRangeSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledRangeSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMALabeledSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMALabeledSliderConfiguring.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledSliderConfiguring.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMARangeFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMARangeFormatter.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMARangeSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMARangeSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMASlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMASliderLiveRenderingStyle.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderLiveRenderingStyle.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMASliderReusableXibControl.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderReusableXibControl.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/BMASliders/BMASliderStyling.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderStyling.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMALabeledRangeSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledRangeSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMALabeledSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMALabeledSliderConfiguring.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMALabeledSliderConfiguring.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMARangeFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMARangeFormatter.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMARangeSlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMARangeSlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMASlider.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASlider.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMASliderLiveRenderingStyle.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderLiveRenderingStyle.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMASliderReusableXibControl.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderReusableXibControl.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/BMASliders/BMASliderStyling.h: -------------------------------------------------------------------------------- 1 | ../../../../../Component/Classes/BMASliderStyling.h -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/BMASliders.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BMASliders", 3 | "version": "1.0.0", 4 | "summary": "Configurable range and simple sliders", 5 | "description": " BMASliders` is a set of reusable sliders. It includes two kind of sliders, one with customizable ranges -`BMARangeSlider`- and a simpler one -`BMASlider`- along with its labeled counterparts -`BMALabeledRangeSlider` and `BMALabeledSlider` \t\t\t\t\n", 6 | "homepage": "http://github.com/badoo/BMASliders", 7 | "license": { 8 | "type": "MIT" 9 | }, 10 | "authors": { 11 | "Diego Sanchez": "diego.sanchez@corp.badoo.com" 12 | }, 13 | "platforms": { 14 | "ios": "8.0" 15 | }, 16 | "source": { 17 | "git": "https://github.com/badoo/BMASliders.git", 18 | "tag": "1.0.0" 19 | }, 20 | "source_files": "Component/Classes/**/*", 21 | "public_header_files": "Component/Classes/*.h", 22 | "resources": "Component/Resources/*", 23 | "requires_arc": true 24 | } 25 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BMASliders (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - BMASliders (from `..`) 6 | 7 | EXTERNAL SOURCES: 8 | BMASliders: 9 | :path: .. 10 | 11 | SPEC CHECKSUMS: 12 | BMASliders: b623bb2e3ff891a5a33cffadec769ffcfcd9ad2c 13 | 14 | COCOAPODS: 0.36.0.rc.1 15 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-BMASliders.xcconfig" 2 | CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH 3 | FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/BMASliders" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BMASliders" 6 | OTHER_LDFLAGS = -ObjC 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods 8 | PODS_ROOT = ${SRCROOT} 9 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BMASliders : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BMASliders 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "BMALabeledRangeSlider.h" 4 | #import "BMALabeledSlider.h" 5 | #import "BMALabeledSliderConfiguring.h" 6 | #import "BMARangeFormatter.h" 7 | #import "BMARangeSlider.h" 8 | #import "BMASlider.h" 9 | #import "BMASliderLiveRenderingStyle.h" 10 | #import "BMASliderReusableXibControl.h" 11 | #import "BMASliderStyling.h" 12 | 13 | FOUNDATION_EXPORT double BMASlidersVersionNumber; 14 | FOUNDATION_EXPORT const unsigned char BMASlidersVersionString[]; 15 | 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders.modulemap: -------------------------------------------------------------------------------- 1 | framework module BMASliders { 2 | umbrella header "Pods-BMASliders-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/Example/Pods/Target Support Files/Pods-BMASliders/Pods-BMASliders.xcconfig -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## BMASliders 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2015 Badoo Development 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 | 29 | Generated by CocoaPods - http://cocoapods.org 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-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 | The MIT License (MIT) 18 | 19 | Copyright (c) 2015 Badoo Development 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 | 40 | Title 41 | BMASliders 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Generated by CocoaPods - http://cocoapods.org 48 | Title 49 | 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | StringsTable 55 | Acknowledgements 56 | Title 57 | Acknowledgements 58 | 59 | 60 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // BMASliders 10 | #define COCOAPODS_POD_AVAILABLE_BMASliders 11 | #define COCOAPODS_VERSION_MAJOR_BMASliders 1 12 | #define COCOAPODS_VERSION_MINOR_BMASliders 0 13 | #define COCOAPODS_VERSION_PATCH_BMASliders 0 14 | 15 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-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 | local source="${BUILT_PRODUCTS_DIR}/Pods/$1" 12 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | 14 | if [ -L "${source}" ]; then 15 | echo "Symlinked..." 16 | source=$(readlink "${source}") 17 | fi 18 | 19 | # use filter instead of exclude so missing patterns dont' throw errors 20 | echo "rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers/" --filter "- PrivateHeaders/" ${source} ${destination}" 21 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers/" --filter "- PrivateHeaders/" "${source}" "${destination}" 22 | # Resign the code if required by the build settings to avoid unstable apps 23 | if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then 24 | code_sign "${destination}/$1" 25 | fi 26 | 27 | # Embed linked Swift runtime libraries 28 | local basename 29 | basename=$(echo $1 | sed -E s/\\..+// && exit ${PIPESTATUS[0]}) 30 | local swift_runtime_libs 31 | swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/$1/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 32 | for lib in $swift_runtime_libs; do 33 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 34 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 35 | if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then 36 | code_sign "${destination}/${lib}" 37 | fi 38 | done 39 | } 40 | 41 | # Signs a framework with the provided identity 42 | code_sign() { 43 | # Use the current code_sign_identitiy 44 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 45 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1" 46 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 47 | } 48 | 49 | 50 | if [[ "$CONFIGURATION" == "Debug" ]]; then 51 | install_framework 'BMASliders.framework' 52 | fi 53 | if [[ "$CONFIGURATION" == "Release" ]]; then 54 | install_framework 'BMASliders.framework' 55 | fi 56 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | install_resource() 10 | { 11 | case $1 in 12 | *.storyboard) 13 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 14 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 15 | ;; 16 | *.xib) 17 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 18 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 19 | ;; 20 | *.framework) 21 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 22 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 23 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 24 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 25 | ;; 26 | *.xcdatamodel) 27 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 28 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 29 | ;; 30 | *.xcdatamodeld) 31 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 32 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 33 | ;; 34 | *.xcmappingmodel) 35 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 36 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 37 | ;; 38 | *.xcassets) 39 | ;; 40 | /*) 41 | echo "$1" 42 | echo "$1" >> "$RESOURCES_TO_COPY" 43 | ;; 44 | *) 45 | echo "${PODS_ROOT}/$1" 46 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 47 | ;; 48 | esac 49 | } 50 | 51 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 52 | if [[ "${ACTION}" == "install" ]]; then 53 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 54 | fi 55 | rm -f "$RESOURCES_TO_COPY" 56 | 57 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] 58 | then 59 | case "${TARGETED_DEVICE_FAMILY}" in 60 | 1,2) 61 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 62 | ;; 63 | 1) 64 | TARGET_DEVICE_ARGS="--target-device iphone" 65 | ;; 66 | 2) 67 | TARGET_DEVICE_ARGS="--target-device ipad" 68 | ;; 69 | *) 70 | TARGET_DEVICE_ARGS="--target-device mac" 71 | ;; 72 | esac 73 | find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 74 | fi 75 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double PodsVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char PodsVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/BMASliders.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -framework "BMASliders" 6 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods { 2 | umbrella header "Pods-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/BMASliders.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -framework "BMASliders" 6 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Badoo Development 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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BMASliders [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://api.travis-ci.org/badoo/BMASliders.svg?branch=1.0.0)](https://travis-ci.org/badoo/BMASliders) 2 | `BMASliders` is a set of reusable sliders. It includes two kind of sliders, one with customizable ranges -`BMARangeSlider`- and a simpler one -`BMASlider`- along with its labeled counterparts -`BMALabeledRangeSlider` and `BMALabeledSlider` 3 | 4 |
5 | 6 |
7 | 8 | ## Features 9 | - Live rendering in Interface Builder 10 | - Configurable minimum distance between handlers 11 | - Ability to allow only discretized values 12 | - Overflow signal 13 | - Configurable appearance 14 | 15 | ## How to use 16 | ### BMALabeledRangeSlider 17 | `BMALabeledRangeSlider` provides a range slider with a title and a detail of the selected range. You can configure many of its properties by using *Attributes inspector* in *Interface Builder*. Alternatively, you can initialize in code as follows: 18 | 19 | ```objectivec 20 | self.labeledRangeSlider.minimumValue = 0.; 21 | self.labeledRangeSlider.maximumValue = 130.; 22 | self.labeledRangeSlider.currentLowerValue = 30.; 23 | self.labeledRangeSlider.currentUpperValue = 70.; 24 | self.labeledRangeSlider.step = 1.; 25 | self.labeledRangeSlider.minimumDistance = 4.; // between handlers 26 | self.labeledRangeSlider.style = [[BMASliderLiveRenderingStyle alloc] init]; 27 | self.labeledRangeSlider.title = [[NSAttributedString alloc] initWithString:@"My title"]; 28 | self.labeledRangeSlider.rangeFormatter = self.myRangeFormatter; 29 | [self.labeledRangeSlider addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged]; 30 | ``` 31 | 32 | Everything should be self-explanatory but `rangeFormatter` and `style`. For `rangeFormatter` you must provide an object conforming to the `BMARangeFormatter` protocol: 33 | ```objectivec 34 | @protocol BMARangeFormatter 35 | @property (nonatomic) BOOL hasLowerValue; 36 | @property (nonatomic) CGFloat lowerValue; 37 | @property (nonatomic) CGFloat upperValue; 38 | @property (nonatomic, getter=isOverflow) BOOL overflow; 39 | 40 | - (NSAttributedString *)formattedString; 41 | @end 42 | ``` 43 | 44 | When the selected range changes, `BMALabeledRangeSlider` will set properties `hasLowerValue`, `lowerValue`, `upperValue` and `overflow` to the `rangeFormatter` instance and will ask it for the string representation of the range by calling `formattedString`. 45 | 46 | For the `style` property, you must supply an instance that returns the images for the handlers and the line backgrounds. `BMASliderLiveRenderingStyle` will be used by default in case you don't provide your own style. 47 | ```objectivec 48 | @protocol BMASliderStyling 49 | - (UIImage *)unselectedLineImage; 50 | - (UIImage *)selectedLineImage; 51 | - (UIImage *)handlerImage; 52 | @end 53 | ``` 54 | 55 | For convenience, `BMASliders` support the UIAppearance protocol so you can easily style all the sliders in your app: 56 | ```objectivec 57 | [BMARangeSlider appearance].style = [[BMASliderDefaultStyle alloc] init]; 58 | [BMASlider appearance].style = [[BMASliderDefaultStyle alloc] init]; 59 | ``` 60 | 61 | ### BMALabeledSlider 62 | `BMALabeledRangeSlider` provides a range slider with a title and a detail of the selected range. It works pretty much the same as `BMALabeledRangeSlider`, but it's got just a `currentValue`. 63 | 64 | ```objectivec 65 | self.labeledSlider.minimumValue = 0.; 66 | self.labeledSlider.maximumValue = 130.; 67 | self.labeledSlider.currentValue = 60.; 68 | self.labeledSlider.style = [[BMASliderDefaultStyle alloc] init]; 69 | self.labeledSlider.title = [[NSAttributedString alloc] initWithString:@"My title"]; 70 | self.labeledSlider.rangeFormatter = self.myRangeFormatter; 71 | [self.labeledSlider addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged]; 72 | ``` 73 | 74 | Note that `rangeFormatter` must again conform to `BMARangeFormatter` protocol. In this case however, the slider will set `hasLowerValue` to `false` and `currentValue` will be assigned to the `upperValue` property. 75 | 76 | ### BMARangeSlider and BMASlider 77 | These are the non-labeled counterparts of `BMALabeledRangeSlider` and `BMALabeledSlider`. They don't have any `title` or `rangeFormatter` so they are easier to configure and can be used to render your custom layouts. 78 | 79 | ## Live rendering 80 | `BMASliders` takes advantage of `IBInspectable` and `IBDesignable` directives that allow you to see how the component renders in *Interface Builder* and change the slider's attributes by using the *Attributes inspector*. 81 | 82 | 83 | ## How to install 84 | ### Using CocoaPods 85 | 86 | 1. Make sure `use_frameworks!` is added to your `Podfile`. Live rendering with XIB-based views requires `use_frameworks!` to work, which is available from CocoaPods 0.36. If you don't add `use_frameworks!` in your `Podfile` live rendering won't work and you'll get some nasty complains in Interface Builder. However, everything should work fine at run time. 87 | 88 | 2. Include the following line in your `Podfile`: 89 | ``` 90 | pod 'BMASliders', '~> 1.0.0' 91 | ``` 92 | If you like to live on the bleeding edge, you can use the `master` branch with: 93 | ``` 94 | pod 'BMASliders', :git => 'https://github.com/badoo/BMASliders' 95 | ``` 96 | 3. Run `pod install` 97 | 98 | ### Manually 99 | 100 | 1. Clone, add as a submodule or [download.](https://github.com/badoo/BMASliders/archive/master.zip) 101 | 2. Add all the files under `Component` to your project. 102 | 3. Make sure your project is configured to use ARC. 103 | 104 | ## License 105 | Source code is distributed under MIT license. 106 | 107 | ## Blog 108 | Read more on our [tech blog](http://techblog.badoo.com/) or explore our other [open source projects](https://github.com/badoo) 109 | -------------------------------------------------------------------------------- /demoimages/labeled-range-slider-movie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/demoimages/labeled-range-slider-movie.gif -------------------------------------------------------------------------------- /demoimages/live-rendering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/BMASliders/13ff5e98220e75f8e34e371593161611c68038e5/demoimages/live-rendering.png --------------------------------------------------------------------------------