├── .CategorySliderView.podspec.swp ├── CategorySliderView.podspec ├── CategorySliderView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── CategorySliderView.xccheckout │ └── xcuserdata │ │ └── cem.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Cem.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── CategorySliderView.xcscheme │ └── xcschememanagement.plist ├── CategorySliderView ├── AppDelegate.h ├── AppDelegate.m ├── CategorySliderView-Info.plist ├── CategorySliderView-Prefix.pch ├── CategorySliderView.h ├── CategorySliderView.m ├── CategorySliderView.xcdatamodeld │ ├── .xccurrentversion │ └── CategorySliderView.xcdatamodel │ │ └── contents ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── TestViewController.h ├── TestViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── CategorySliderViewTests ├── CategorySliderViewTests-Info.plist ├── CategorySliderViewTests.m └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── demo.gif /.CategorySliderView.podspec.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cemolcay/CategorySliderView/b18e5a4abf5e8a4009ba3706f9df98d10ac7aed5/.CategorySliderView.podspec.swp -------------------------------------------------------------------------------- /CategorySliderView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint CategorySliderView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "CategorySliderView" 19 | s.version = "1.0.2" 20 | s.summary = "slider view for choosing categories. add any UIView type as category item view ." 21 | 22 | s.description = <<-DESC 23 | CategorySliderView 24 | ================== 25 | 26 | Horizontal or vertical slider view for choosing categories. Add any UIView type as category item view. Fully customisable 27 | 28 | Demo 29 | ==== 30 | ![alt tag](https://raw.githubusercontent.com/cemolcay/CategorySliderView/master/demo.gif) 31 | 32 | Usage 33 | ----- 34 | Copy CategorySliderView.h/m files into your project. 35 | 36 | UILabel *category1 = ...... 37 | UILabel *category2 = ...... 38 | UILabel *category3 = ...... 39 | ... 40 | 41 | CategorySliderView *sliderView = [[CategorySliderView alloc] initWithSliderHeight:60 andCategoryViews:@[category1, category2, category3] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) { 42 | UILabel *selectedView = (UILabel *)categoryView; 43 | NSLog(@"\"%@\" cateogry selected at index %d", selectedView.text, categoryIndex); 44 | }]; 45 | [self.view addSubview:sliderView]; 46 | 47 | 48 | you can add as many items as you want 49 | 50 | UIView *newCategoryView = ..... 51 | [sliderView addCategoryView:newCategoryView]; 52 | 53 | 54 | 55 | Optional Properties 56 | ------------------- 57 | 58 | shouldAutoScrollSlider: scrolls to closest category item after dragging ends 59 | shouldAutoSelectScrolledCategory: selects the closest category item after dragging ends 60 | categoryViewPadding: padding between category item views 61 | backgroundImage: background image for slider 62 | DESC 63 | 64 | s.homepage = "https://github.com/cemolcay/CategorySliderView" 65 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 66 | 67 | 68 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 69 | # 70 | # Licensing your code is important. See http://choosealicense.com for more info. 71 | # CocoaPods will detect a license file if there is a named LICENSE* 72 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 73 | # 74 | 75 | s.license = "MIT" 76 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 77 | 78 | 79 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 80 | # 81 | # Specify the authors of the library, with email addresses. Email addresses 82 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 83 | # accepts just a name if you'd rather not provide an email address. 84 | # 85 | # Specify a social_media_url where others can refer to, for example a twitter 86 | # profile URL. 87 | # 88 | 89 | s.author = { "Cem Olcay" => "ccemolcay@gmail.com" } 90 | # Or just: s.author = "Cem Olcay" 91 | # s.authors = { "Cem Olcay" => "ccemolcay@gmail.com" } 92 | # s.social_media_url = "http://twitter.com/Cem Olcay" 93 | 94 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 95 | # 96 | # If this Pod runs only on iOS or OS X, then specify the platform and 97 | # the deployment target. You can optionally include the target after the platform. 98 | # 99 | 100 | s.platform = :ios 101 | # s.platform = :ios, "5.0" 102 | 103 | # When using multiple platforms 104 | # s.ios.deployment_target = "5.0" 105 | # s.osx.deployment_target = "10.7" 106 | 107 | 108 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 109 | # 110 | # Specify the location from where the source should be retrieved. 111 | # Supports git, hg, bzr, svn and HTTP. 112 | # 113 | 114 | s.source = { :git => "https://github.com/cemolcay/CategorySliderView.git", :tag => "v1.0.2" } 115 | 116 | 117 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 118 | # 119 | # CocoaPods is smart about how it includes source code. For source files 120 | # giving a folder will include any h, m, mm, c & cpp files. For header 121 | # files it will include any header in the folder. 122 | # Not including the public_header_files will make all headers public. 123 | # 124 | 125 | s.source_files = "CategorySliderView/*.{h,m}" 126 | 127 | # s.public_header_files = "Classes/**/*.h" 128 | 129 | 130 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 131 | # 132 | # A list of resources included with the Pod. These are copied into the 133 | # target bundle with a build phase script. Anything else will be cleaned. 134 | # You can preserve files from being cleaned, please don't preserve 135 | # non-essential files like tests, examples and documentation. 136 | # 137 | 138 | # s.resource = "icon.png" 139 | # s.resources = "Resources/*.png" 140 | 141 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 142 | 143 | 144 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 145 | # 146 | # Link your library with frameworks, or libraries. Libraries do not include 147 | # the lib prefix of their name. 148 | # 149 | 150 | # s.framework = "SomeFramework" 151 | # s.frameworks = "SomeFramework", "AnotherFramework" 152 | 153 | # s.library = "iconv" 154 | # s.libraries = "iconv", "xml2" 155 | 156 | 157 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 158 | # 159 | # If your library depends on compiler flags you can set them in the xcconfig hash 160 | # where they will only apply to your library. If you depend on other Podspecs 161 | # you can include multiple dependencies to ensure it works. 162 | 163 | s.requires_arc = true 164 | 165 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 166 | # s.dependency "JSONKit", "~> 1.4" 167 | 168 | end 169 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B2BF885E1966B87000A78FD2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF885D1966B87000A78FD2 /* Foundation.framework */; }; 11 | B2BF88601966B87000A78FD2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF885F1966B87000A78FD2 /* CoreGraphics.framework */; }; 12 | B2BF88621966B87000A78FD2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF88611966B87000A78FD2 /* UIKit.framework */; }; 13 | B2BF886A1966B87000A78FD2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B2BF88681966B87000A78FD2 /* InfoPlist.strings */; }; 14 | B2BF886C1966B87000A78FD2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BF886B1966B87000A78FD2 /* main.m */; }; 15 | B2BF88701966B87000A78FD2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BF886F1966B87000A78FD2 /* AppDelegate.m */; }; 16 | B2BF88731966B87000A78FD2 /* CategorySliderView.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B2BF88711966B87000A78FD2 /* CategorySliderView.xcdatamodeld */; }; 17 | B2BF88751966B87000A78FD2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2BF88741966B87000A78FD2 /* Images.xcassets */; }; 18 | B2BF887C1966B87000A78FD2 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF887B1966B87000A78FD2 /* XCTest.framework */; }; 19 | B2BF887D1966B87000A78FD2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF885D1966B87000A78FD2 /* Foundation.framework */; }; 20 | B2BF887E1966B87000A78FD2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF88611966B87000A78FD2 /* UIKit.framework */; }; 21 | B2BF88871966B87000A78FD2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B2BF88851966B87000A78FD2 /* InfoPlist.strings */; }; 22 | B2BF88891966B87000A78FD2 /* CategorySliderViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BF88881966B87000A78FD2 /* CategorySliderViewTests.m */; }; 23 | B2BF88941966B88A00A78FD2 /* TestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BF88931966B88A00A78FD2 /* TestViewController.m */; }; 24 | B2BF88971966B89B00A78FD2 /* CategorySliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BF88961966B89B00A78FD2 /* CategorySliderView.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | B2BF88801966B87000A78FD2 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = B2BF88521966B87000A78FD2 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = B2BF88591966B87000A78FD2; 33 | remoteInfo = CategorySliderView; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | B2BF885A1966B87000A78FD2 /* CategorySliderView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CategorySliderView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | B2BF885D1966B87000A78FD2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 40 | B2BF885F1966B87000A78FD2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 41 | B2BF88611966B87000A78FD2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 42 | B2BF88671966B87000A78FD2 /* CategorySliderView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CategorySliderView-Info.plist"; sourceTree = ""; }; 43 | B2BF88691966B87000A78FD2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 44 | B2BF886B1966B87000A78FD2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | B2BF886D1966B87000A78FD2 /* CategorySliderView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CategorySliderView-Prefix.pch"; sourceTree = ""; }; 46 | B2BF886E1966B87000A78FD2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 47 | B2BF886F1966B87000A78FD2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 48 | B2BF88721966B87000A78FD2 /* CategorySliderView.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = CategorySliderView.xcdatamodel; sourceTree = ""; }; 49 | B2BF88741966B87000A78FD2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 50 | B2BF887A1966B87000A78FD2 /* CategorySliderViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CategorySliderViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | B2BF887B1966B87000A78FD2 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 52 | B2BF88841966B87000A78FD2 /* CategorySliderViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CategorySliderViewTests-Info.plist"; sourceTree = ""; }; 53 | B2BF88861966B87000A78FD2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 54 | B2BF88881966B87000A78FD2 /* CategorySliderViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CategorySliderViewTests.m; sourceTree = ""; }; 55 | B2BF88921966B88A00A78FD2 /* TestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestViewController.h; sourceTree = ""; }; 56 | B2BF88931966B88A00A78FD2 /* TestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestViewController.m; sourceTree = ""; }; 57 | B2BF88951966B89B00A78FD2 /* CategorySliderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CategorySliderView.h; sourceTree = ""; }; 58 | B2BF88961966B89B00A78FD2 /* CategorySliderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CategorySliderView.m; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | B2BF88571966B87000A78FD2 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | B2BF88601966B87000A78FD2 /* CoreGraphics.framework in Frameworks */, 67 | B2BF88621966B87000A78FD2 /* UIKit.framework in Frameworks */, 68 | B2BF885E1966B87000A78FD2 /* Foundation.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | B2BF88771966B87000A78FD2 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | B2BF887C1966B87000A78FD2 /* XCTest.framework in Frameworks */, 77 | B2BF887E1966B87000A78FD2 /* UIKit.framework in Frameworks */, 78 | B2BF887D1966B87000A78FD2 /* Foundation.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | B2BF88511966B87000A78FD2 = { 86 | isa = PBXGroup; 87 | children = ( 88 | B2BF88651966B87000A78FD2 /* CategorySliderView */, 89 | B2BF88821966B87000A78FD2 /* CategorySliderViewTests */, 90 | B2BF885C1966B87000A78FD2 /* Frameworks */, 91 | B2BF885B1966B87000A78FD2 /* Products */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | B2BF885B1966B87000A78FD2 /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | B2BF885A1966B87000A78FD2 /* CategorySliderView.app */, 99 | B2BF887A1966B87000A78FD2 /* CategorySliderViewTests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | B2BF885C1966B87000A78FD2 /* Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | B2BF885D1966B87000A78FD2 /* Foundation.framework */, 108 | B2BF885F1966B87000A78FD2 /* CoreGraphics.framework */, 109 | B2BF88611966B87000A78FD2 /* UIKit.framework */, 110 | B2BF887B1966B87000A78FD2 /* XCTest.framework */, 111 | ); 112 | name = Frameworks; 113 | sourceTree = ""; 114 | }; 115 | B2BF88651966B87000A78FD2 /* CategorySliderView */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | B2BF88981966B8FA00A78FD2 /* CategorySliderView */, 119 | B2BF886E1966B87000A78FD2 /* AppDelegate.h */, 120 | B2BF886F1966B87000A78FD2 /* AppDelegate.m */, 121 | B2BF88921966B88A00A78FD2 /* TestViewController.h */, 122 | B2BF88931966B88A00A78FD2 /* TestViewController.m */, 123 | B2BF88661966B87000A78FD2 /* Supporting Files */, 124 | ); 125 | path = CategorySliderView; 126 | sourceTree = ""; 127 | }; 128 | B2BF88661966B87000A78FD2 /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | B2BF88741966B87000A78FD2 /* Images.xcassets */, 132 | B2BF88711966B87000A78FD2 /* CategorySliderView.xcdatamodeld */, 133 | B2BF88671966B87000A78FD2 /* CategorySliderView-Info.plist */, 134 | B2BF88681966B87000A78FD2 /* InfoPlist.strings */, 135 | B2BF886B1966B87000A78FD2 /* main.m */, 136 | B2BF886D1966B87000A78FD2 /* CategorySliderView-Prefix.pch */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | B2BF88821966B87000A78FD2 /* CategorySliderViewTests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | B2BF88881966B87000A78FD2 /* CategorySliderViewTests.m */, 145 | B2BF88831966B87000A78FD2 /* Supporting Files */, 146 | ); 147 | path = CategorySliderViewTests; 148 | sourceTree = ""; 149 | }; 150 | B2BF88831966B87000A78FD2 /* Supporting Files */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | B2BF88841966B87000A78FD2 /* CategorySliderViewTests-Info.plist */, 154 | B2BF88851966B87000A78FD2 /* InfoPlist.strings */, 155 | ); 156 | name = "Supporting Files"; 157 | sourceTree = ""; 158 | }; 159 | B2BF88981966B8FA00A78FD2 /* CategorySliderView */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | B2BF88951966B89B00A78FD2 /* CategorySliderView.h */, 163 | B2BF88961966B89B00A78FD2 /* CategorySliderView.m */, 164 | ); 165 | name = CategorySliderView; 166 | sourceTree = ""; 167 | }; 168 | /* End PBXGroup section */ 169 | 170 | /* Begin PBXNativeTarget section */ 171 | B2BF88591966B87000A78FD2 /* CategorySliderView */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = B2BF888C1966B87000A78FD2 /* Build configuration list for PBXNativeTarget "CategorySliderView" */; 174 | buildPhases = ( 175 | B2BF88561966B87000A78FD2 /* Sources */, 176 | B2BF88571966B87000A78FD2 /* Frameworks */, 177 | B2BF88581966B87000A78FD2 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = CategorySliderView; 184 | productName = CategorySliderView; 185 | productReference = B2BF885A1966B87000A78FD2 /* CategorySliderView.app */; 186 | productType = "com.apple.product-type.application"; 187 | }; 188 | B2BF88791966B87000A78FD2 /* CategorySliderViewTests */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = B2BF888F1966B87000A78FD2 /* Build configuration list for PBXNativeTarget "CategorySliderViewTests" */; 191 | buildPhases = ( 192 | B2BF88761966B87000A78FD2 /* Sources */, 193 | B2BF88771966B87000A78FD2 /* Frameworks */, 194 | B2BF88781966B87000A78FD2 /* Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | B2BF88811966B87000A78FD2 /* PBXTargetDependency */, 200 | ); 201 | name = CategorySliderViewTests; 202 | productName = CategorySliderViewTests; 203 | productReference = B2BF887A1966B87000A78FD2 /* CategorySliderViewTests.xctest */; 204 | productType = "com.apple.product-type.bundle.unit-test"; 205 | }; 206 | /* End PBXNativeTarget section */ 207 | 208 | /* Begin PBXProject section */ 209 | B2BF88521966B87000A78FD2 /* Project object */ = { 210 | isa = PBXProject; 211 | attributes = { 212 | LastUpgradeCheck = 0510; 213 | ORGANIZATIONNAME = questamobile; 214 | TargetAttributes = { 215 | B2BF88791966B87000A78FD2 = { 216 | TestTargetID = B2BF88591966B87000A78FD2; 217 | }; 218 | }; 219 | }; 220 | buildConfigurationList = B2BF88551966B87000A78FD2 /* Build configuration list for PBXProject "CategorySliderView" */; 221 | compatibilityVersion = "Xcode 3.2"; 222 | developmentRegion = English; 223 | hasScannedForEncodings = 0; 224 | knownRegions = ( 225 | en, 226 | ); 227 | mainGroup = B2BF88511966B87000A78FD2; 228 | productRefGroup = B2BF885B1966B87000A78FD2 /* Products */; 229 | projectDirPath = ""; 230 | projectRoot = ""; 231 | targets = ( 232 | B2BF88591966B87000A78FD2 /* CategorySliderView */, 233 | B2BF88791966B87000A78FD2 /* CategorySliderViewTests */, 234 | ); 235 | }; 236 | /* End PBXProject section */ 237 | 238 | /* Begin PBXResourcesBuildPhase section */ 239 | B2BF88581966B87000A78FD2 /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | B2BF886A1966B87000A78FD2 /* InfoPlist.strings in Resources */, 244 | B2BF88751966B87000A78FD2 /* Images.xcassets in Resources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | B2BF88781966B87000A78FD2 /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | B2BF88871966B87000A78FD2 /* InfoPlist.strings in Resources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | /* End PBXResourcesBuildPhase section */ 257 | 258 | /* Begin PBXSourcesBuildPhase section */ 259 | B2BF88561966B87000A78FD2 /* Sources */ = { 260 | isa = PBXSourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | B2BF88701966B87000A78FD2 /* AppDelegate.m in Sources */, 264 | B2BF88971966B89B00A78FD2 /* CategorySliderView.m in Sources */, 265 | B2BF88731966B87000A78FD2 /* CategorySliderView.xcdatamodeld in Sources */, 266 | B2BF88941966B88A00A78FD2 /* TestViewController.m in Sources */, 267 | B2BF886C1966B87000A78FD2 /* main.m in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | B2BF88761966B87000A78FD2 /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | B2BF88891966B87000A78FD2 /* CategorySliderViewTests.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | B2BF88811966B87000A78FD2 /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = B2BF88591966B87000A78FD2 /* CategorySliderView */; 285 | targetProxy = B2BF88801966B87000A78FD2 /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin PBXVariantGroup section */ 290 | B2BF88681966B87000A78FD2 /* InfoPlist.strings */ = { 291 | isa = PBXVariantGroup; 292 | children = ( 293 | B2BF88691966B87000A78FD2 /* en */, 294 | ); 295 | name = InfoPlist.strings; 296 | sourceTree = ""; 297 | }; 298 | B2BF88851966B87000A78FD2 /* InfoPlist.strings */ = { 299 | isa = PBXVariantGroup; 300 | children = ( 301 | B2BF88861966B87000A78FD2 /* en */, 302 | ); 303 | name = InfoPlist.strings; 304 | sourceTree = ""; 305 | }; 306 | /* End PBXVariantGroup section */ 307 | 308 | /* Begin XCBuildConfiguration section */ 309 | B2BF888A1966B87000A78FD2 /* Debug */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 314 | CLANG_CXX_LIBRARY = "libc++"; 315 | CLANG_ENABLE_MODULES = YES; 316 | CLANG_ENABLE_OBJC_ARC = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_CONSTANT_CONVERSION = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 325 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 326 | COPY_PHASE_STRIP = NO; 327 | GCC_C_LANGUAGE_STANDARD = gnu99; 328 | GCC_DYNAMIC_NO_PIC = NO; 329 | GCC_OPTIMIZATION_LEVEL = 0; 330 | GCC_PREPROCESSOR_DEFINITIONS = ( 331 | "DEBUG=1", 332 | "$(inherited)", 333 | ); 334 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 335 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 336 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 337 | GCC_WARN_UNDECLARED_SELECTOR = YES; 338 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 339 | GCC_WARN_UNUSED_FUNCTION = YES; 340 | GCC_WARN_UNUSED_VARIABLE = YES; 341 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 342 | ONLY_ACTIVE_ARCH = YES; 343 | SDKROOT = iphoneos; 344 | }; 345 | name = Debug; 346 | }; 347 | B2BF888B1966B87000A78FD2 /* Release */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ALWAYS_SEARCH_USER_PATHS = NO; 351 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 352 | CLANG_CXX_LIBRARY = "libc++"; 353 | CLANG_ENABLE_MODULES = YES; 354 | CLANG_ENABLE_OBJC_ARC = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_CONSTANT_CONVERSION = YES; 357 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 358 | CLANG_WARN_EMPTY_BODY = YES; 359 | CLANG_WARN_ENUM_CONVERSION = YES; 360 | CLANG_WARN_INT_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = YES; 365 | ENABLE_NS_ASSERTIONS = NO; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 374 | SDKROOT = iphoneos; 375 | VALIDATE_PRODUCT = YES; 376 | }; 377 | name = Release; 378 | }; 379 | B2BF888D1966B87000A78FD2 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 383 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 384 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 385 | GCC_PREFIX_HEADER = "CategorySliderView/CategorySliderView-Prefix.pch"; 386 | INFOPLIST_FILE = "CategorySliderView/CategorySliderView-Info.plist"; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | WRAPPER_EXTENSION = app; 389 | }; 390 | name = Debug; 391 | }; 392 | B2BF888E1966B87000A78FD2 /* Release */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 397 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 398 | GCC_PREFIX_HEADER = "CategorySliderView/CategorySliderView-Prefix.pch"; 399 | INFOPLIST_FILE = "CategorySliderView/CategorySliderView-Info.plist"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | WRAPPER_EXTENSION = app; 402 | }; 403 | name = Release; 404 | }; 405 | B2BF88901966B87000A78FD2 /* Debug */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CategorySliderView.app/CategorySliderView"; 409 | FRAMEWORK_SEARCH_PATHS = ( 410 | "$(SDKROOT)/Developer/Library/Frameworks", 411 | "$(inherited)", 412 | "$(DEVELOPER_FRAMEWORKS_DIR)", 413 | ); 414 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 415 | GCC_PREFIX_HEADER = "CategorySliderView/CategorySliderView-Prefix.pch"; 416 | GCC_PREPROCESSOR_DEFINITIONS = ( 417 | "DEBUG=1", 418 | "$(inherited)", 419 | ); 420 | INFOPLIST_FILE = "CategorySliderViewTests/CategorySliderViewTests-Info.plist"; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | TEST_HOST = "$(BUNDLE_LOADER)"; 423 | WRAPPER_EXTENSION = xctest; 424 | }; 425 | name = Debug; 426 | }; 427 | B2BF88911966B87000A78FD2 /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CategorySliderView.app/CategorySliderView"; 431 | FRAMEWORK_SEARCH_PATHS = ( 432 | "$(SDKROOT)/Developer/Library/Frameworks", 433 | "$(inherited)", 434 | "$(DEVELOPER_FRAMEWORKS_DIR)", 435 | ); 436 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 437 | GCC_PREFIX_HEADER = "CategorySliderView/CategorySliderView-Prefix.pch"; 438 | INFOPLIST_FILE = "CategorySliderViewTests/CategorySliderViewTests-Info.plist"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUNDLE_LOADER)"; 441 | WRAPPER_EXTENSION = xctest; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | B2BF88551966B87000A78FD2 /* Build configuration list for PBXProject "CategorySliderView" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | B2BF888A1966B87000A78FD2 /* Debug */, 452 | B2BF888B1966B87000A78FD2 /* Release */, 453 | ); 454 | defaultConfigurationIsVisible = 0; 455 | defaultConfigurationName = Release; 456 | }; 457 | B2BF888C1966B87000A78FD2 /* Build configuration list for PBXNativeTarget "CategorySliderView" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | B2BF888D1966B87000A78FD2 /* Debug */, 461 | B2BF888E1966B87000A78FD2 /* Release */, 462 | ); 463 | defaultConfigurationIsVisible = 0; 464 | defaultConfigurationName = Release; 465 | }; 466 | B2BF888F1966B87000A78FD2 /* Build configuration list for PBXNativeTarget "CategorySliderViewTests" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | B2BF88901966B87000A78FD2 /* Debug */, 470 | B2BF88911966B87000A78FD2 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | /* End XCConfigurationList section */ 476 | 477 | /* Begin XCVersionGroup section */ 478 | B2BF88711966B87000A78FD2 /* CategorySliderView.xcdatamodeld */ = { 479 | isa = XCVersionGroup; 480 | children = ( 481 | B2BF88721966B87000A78FD2 /* CategorySliderView.xcdatamodel */, 482 | ); 483 | currentVersion = B2BF88721966B87000A78FD2 /* CategorySliderView.xcdatamodel */; 484 | path = CategorySliderView.xcdatamodeld; 485 | sourceTree = ""; 486 | versionGroupType = wrapper.xcdatamodel; 487 | }; 488 | /* End XCVersionGroup section */ 489 | }; 490 | rootObject = B2BF88521966B87000A78FD2 /* Project object */; 491 | } 492 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/project.xcworkspace/xcshareddata/CategorySliderView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 9070D883-868D-4515-88A4-ECE4E78683FF 9 | IDESourceControlProjectName 10 | CategorySliderView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | B1031CB752D55C5A92CF24D3B611DAE8E35E9BAD 14 | https://github.com/cemolcay/CategorySliderView.git 15 | 16 | IDESourceControlProjectPath 17 | CategorySliderView.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | B1031CB752D55C5A92CF24D3B611DAE8E35E9BAD 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/cemolcay/CategorySliderView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | B1031CB752D55C5A92CF24D3B611DAE8E35E9BAD 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | B1031CB752D55C5A92CF24D3B611DAE8E35E9BAD 36 | IDESourceControlWCCName 37 | CategorySliderView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cemolcay/CategorySliderView/b18e5a4abf5e8a4009ba3706f9df98d10ac7aed5/CategorySliderView.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/xcuserdata/Cem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/xcuserdata/Cem.xcuserdatad/xcschemes/CategorySliderView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CategorySliderView.xcodeproj/xcuserdata/Cem.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CategorySliderView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B2BF88591966B87000A78FD2 16 | 17 | primary 18 | 19 | 20 | B2BF88791966B87000A78FD2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CategorySliderView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CategorySliderView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "TestViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | // Override point for customization after application launch. 19 | self.window.backgroundColor = [UIColor whiteColor]; 20 | [self.window makeKeyAndVisible]; 21 | 22 | TestViewController *test= [[TestViewController alloc] init]; 23 | [self.window setRootViewController:test]; 24 | 25 | return YES; 26 | } 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application 29 | { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 32 | } 33 | 34 | - (void)applicationDidEnterBackground:(UIApplication *)application 35 | { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | - (void)applicationWillEnterForeground:(UIApplication *)application 41 | { 42 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application 46 | { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | - (void)applicationWillTerminate:(UIApplication *)application 51 | { 52 | // Saves changes in the application's managed object context before the application terminates. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | org.questamobile.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #import 17 | #endif 18 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategorySliderView.h 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, SliderDirection) { 12 | SliderDirectionHorizontal, 13 | SliderDirectionVertical, 14 | }; 15 | 16 | typedef void(^categorySelected)(UIView *categoryView, NSInteger categoryIndex); 17 | 18 | @interface CategorySliderView : UIView 19 | 20 | @property (copy) categorySelected categorySelectedBlock; 21 | 22 | @property (nonatomic, strong) UIImage *backgroundImage; 23 | @property (assign) SliderDirection sliderDirection; 24 | @property (assign) NSInteger categoryViewPadding; //default 20 25 | @property (assign) BOOL shouldAutoScrollSlider; // default YES auto scrolls closest category after scroll drag ends 26 | @property (assign) BOOL shouldAutoSelectScrolledCategory; // default YES auto selects the slided category 27 | 28 | - (instancetype)initWithFrame:(CGRect)frame andSliderDirection:(SliderDirection)direction; 29 | - (instancetype)initWithFrame:(CGRect)frame andCategoryViews:(NSArray *)categoryViews sliderDirection:(SliderDirection)direction categorySelectionBlock:(categorySelected)block; 30 | - (instancetype)initWithSliderHeight:(CGFloat)height andCategoryViews:(NSArray *)categoryViews categorySelectionBlock:(categorySelected)block; 31 | - (instancetype)initWithSliderWidth:(CGFloat)width andCategoryViews:(NSArray *)categoryViews categorySelectionBlock:(categorySelected)block; 32 | 33 | - (void)addCategoryView:(UIView *)view; 34 | 35 | - (void)setX:(CGFloat)x; 36 | - (void)setY:(CGFloat)y; 37 | 38 | - (void)moveX:(CGFloat)x duration:(NSTimeInterval)duration complation:(void(^)(void))complation; 39 | - (void)moveY:(CGFloat)y duration:(NSTimeInterval)duration complation:(void(^)(void))complation; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CategorySliderView.m 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import "CategorySliderView.h" 10 | 11 | #define ScreenWidth [UIScreen mainScreen].bounds.size.width 12 | #define ScreenHeight [UIScreen mainScreen].bounds.size.height 13 | 14 | @interface CategorySliderView () 15 | @property (nonatomic, strong) UIScrollView *scrollView; 16 | @property (nonatomic, strong) NSMutableArray *categoryViews; 17 | @end 18 | 19 | @implementation CategorySliderView 20 | 21 | - (instancetype)initWithFrame:(CGRect)frame andSliderDirection:(SliderDirection)direction { 22 | if ((self = [self initWithFrame:frame andCategoryViews:nil sliderDirection:direction categorySelectionBlock:nil])) { 23 | 24 | } 25 | return self; 26 | } 27 | 28 | 29 | - (instancetype)initWithSliderHeight:(CGFloat)height andCategoryViews:(NSArray *)categoryViews categorySelectionBlock:(categorySelected)block { 30 | if ((self = [self initWithFrame:CGRectMake(0, 0, ScreenWidth, height) andCategoryViews:categoryViews sliderDirection:SliderDirectionHorizontal categorySelectionBlock:block])) { 31 | 32 | } 33 | return self; 34 | } 35 | 36 | - (instancetype)initWithSliderWidth:(CGFloat)width andCategoryViews:(NSArray *)categoryViews categorySelectionBlock:(categorySelected)block { 37 | if ((self = [self initWithFrame:CGRectMake(0, 0, width, ScreenHeight) andCategoryViews:categoryViews sliderDirection:SliderDirectionVertical categorySelectionBlock:block])) { 38 | 39 | } 40 | return self; 41 | } 42 | 43 | 44 | - (instancetype)initWithFrame:(CGRect)frame andCategoryViews:(NSArray *)categoryViews sliderDirection:(SliderDirection)direction categorySelectionBlock:(categorySelected)block { 45 | if ((self = [super initWithFrame:frame])) { 46 | self.clipsToBounds = YES; 47 | 48 | self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; 49 | [self.scrollView setDelegate:self]; 50 | [self.scrollView setShowsHorizontalScrollIndicator:NO]; 51 | [self.scrollView setShowsVerticalScrollIndicator:NO]; 52 | [self addSubview:self.scrollView]; 53 | 54 | self.sliderDirection = direction; 55 | self.categorySelectedBlock = block; 56 | self.categoryViews = [[NSMutableArray alloc] init]; 57 | self.categoryViewPadding = 20; 58 | self.shouldAutoScrollSlider = YES; 59 | self.shouldAutoSelectScrolledCategory = YES; 60 | 61 | for (UIView *v in categoryViews) { 62 | [self addCategoryView:v]; 63 | } 64 | } 65 | return self; 66 | } 67 | 68 | 69 | #pragma mark - Slider 70 | 71 | - (void)addCategoryView:(UIView *)view { 72 | 73 | if (self.sliderDirection == SliderDirectionHorizontal) { 74 | float w = 0; 75 | if (self.categoryViews.count > 0) { 76 | UIView *lastView = [self.categoryViews lastObject]; 77 | w = lastView.frame.origin.x+lastView.frame.size.width+self.categoryViewPadding; 78 | } 79 | else { 80 | w = [self width]/2 - view.frame.size.width/2; 81 | } 82 | 83 | [self.scrollView addSubview:view]; 84 | [view setFrame:CGRectMake(w, 0, view.frame.size.width, view.frame.size.height)]; 85 | 86 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(categoryViewTapped:)]; 87 | [tap setNumberOfTapsRequired:1]; 88 | [view setUserInteractionEnabled:YES]; 89 | [view addGestureRecognizer:tap]; 90 | [view setTag:self.categoryViews.count]; 91 | 92 | w += [self width]/2 + view.frame.size.width/2; 93 | [self.scrollView setContentSize:CGSizeMake(w, self.scrollView.contentSize.height)]; 94 | [self.categoryViews addObject:view]; 95 | } 96 | else if (self.sliderDirection == SliderDirectionVertical) { 97 | float h = 0; 98 | if (self.categoryViews.count > 0) { 99 | UIView *lastView = [self.categoryViews lastObject]; 100 | h = lastView.frame.origin.y+lastView.frame.size.height+self.categoryViewPadding; 101 | } 102 | else { 103 | h = [self height]/2 - view.frame.size.height/2; 104 | } 105 | 106 | [self.scrollView addSubview:view]; 107 | [view setFrame:CGRectMake(0, h, view.frame.size.width, view.frame.size.height)]; 108 | 109 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(categoryViewTapped:)]; 110 | [tap setNumberOfTapsRequired:1]; 111 | [view setUserInteractionEnabled:YES]; 112 | [view addGestureRecognizer:tap]; 113 | [view setTag:self.categoryViews.count]; 114 | 115 | h += [self height]/2 + view.frame.size.height/2; 116 | [self.scrollView setContentSize:CGSizeMake(self.scrollView.contentSize.width, h)]; 117 | [self.categoryViews addObject:view]; 118 | }} 119 | 120 | - (void)setBackgroundImage:(UIImage *)image { 121 | _backgroundImage = image; 122 | 123 | UIImageView *imageView = (UIImageView *)[self viewWithTag:100]; 124 | if (imageView) { 125 | [imageView setImage:image]; 126 | } 127 | else { 128 | imageView = [[UIImageView alloc] initWithFrame:self.frame]; 129 | [imageView setImage:image]; 130 | [imageView setTag:100]; 131 | [self addSubview:imageView]; 132 | 133 | [self bringSubviewToFront:self.scrollView]; 134 | } 135 | } 136 | 137 | - (void)setBackgroundColor:(UIColor *)backgroundColor { 138 | [self.scrollView setBackgroundColor:backgroundColor]; 139 | } 140 | 141 | - (void)categoryViewTapped:(UITapGestureRecognizer *)tap { 142 | [self slideItemAtIndex:tap.view.tag animated:YES]; 143 | 144 | if (self.categorySelectedBlock && !self.shouldAutoSelectScrolledCategory) 145 | self.categorySelectedBlock ([self.categoryViews objectAtIndex:tap.view.tag], tap.view.tag); 146 | } 147 | 148 | 149 | #pragma mark - UIView 150 | 151 | - (void)setX:(CGFloat)x { 152 | [self setFrame:CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height)]; 153 | } 154 | 155 | - (void)setY:(CGFloat)y { 156 | [self setFrame:CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height)]; 157 | } 158 | 159 | - (void)moveX:(CGFloat)x duration:(NSTimeInterval)duration complation:(void(^)(void))complation { 160 | [UIView animateWithDuration:duration animations:^{ 161 | [self setX:x]; 162 | } completion:^(BOOL finished) { 163 | if (complation) 164 | complation(); 165 | }]; 166 | } 167 | 168 | - (void)moveY:(CGFloat)y duration:(NSTimeInterval)duration complation:(void(^)(void))complation { 169 | [UIView animateWithDuration:duration animations:^{ 170 | [self setY:y]; 171 | } completion:^(BOOL finished) { 172 | if (complation) 173 | complation(); 174 | }]; 175 | } 176 | 177 | 178 | - (CGFloat)width { 179 | return self.frame.size.width; 180 | } 181 | 182 | - (CGFloat)height { 183 | return self.frame.size.height; 184 | } 185 | 186 | - (CGFloat)contentWidth { 187 | return self.scrollView.contentSize.width; 188 | } 189 | 190 | - (CGFloat)contentHeight { 191 | return self.scrollView.contentSize.height; 192 | } 193 | 194 | 195 | #pragma mark - Sliding 196 | 197 | - (void)slideItemAtIndex:(NSInteger)index animated:(BOOL)animated { 198 | UIView *v = [self.categoryViews objectAtIndex:index]; 199 | 200 | if (self.sliderDirection == SliderDirectionHorizontal) 201 | [self.scrollView setContentOffset:CGPointMake(v.center.x - [self width]/2, self.scrollView.contentOffset.y) animated:animated]; 202 | else if (self.sliderDirection == SliderDirectionVertical) 203 | [self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, v.center.y - [self height]/2) animated:animated]; 204 | 205 | if (self.shouldAutoSelectScrolledCategory) 206 | if (self.categorySelectedBlock) 207 | self.categorySelectedBlock (v, index); 208 | } 209 | 210 | - (void)stopScroll { 211 | CGPoint offset = self.scrollView.contentOffset; 212 | [self.scrollView setContentOffset:offset animated:NO]; 213 | } 214 | 215 | 216 | #pragma mark - UIScrollViewDelegate 217 | 218 | - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { 219 | if (!self.shouldAutoScrollSlider) 220 | return; 221 | 222 | if (self.sliderDirection == SliderDirectionHorizontal) { 223 | if (velocity.x == 0) 224 | { 225 | float x = scrollView.contentOffset.x + [self width]/2; 226 | float distance = 1000; 227 | int closest = -1; 228 | 229 | for (int i = 0; i < self.categoryViews.count; i++) 230 | { 231 | UIView *view = (UIView*)[self.categoryViews objectAtIndex:i]; 232 | 233 | if (abs(x - view.center.x) < distance) 234 | { 235 | distance = abs(x-view.center.x); 236 | closest = i; 237 | } 238 | } 239 | 240 | [self slideItemAtIndex:closest animated:YES]; 241 | } 242 | } 243 | else if (self.sliderDirection == SliderDirectionVertical) { 244 | if (velocity.x == 0) 245 | { 246 | float y = scrollView.contentOffset.y + [self height]/2; 247 | float distance = 1000; 248 | int closest = -1; 249 | 250 | for (int i = 0; i < self.categoryViews.count; i++) 251 | { 252 | UIView *view = (UIView*)[self.categoryViews objectAtIndex:i]; 253 | 254 | if (abs(y - view.center.y) < distance) 255 | { 256 | distance = abs(y-view.center.y); 257 | closest = i; 258 | } 259 | } 260 | 261 | [self slideItemAtIndex:closest animated:YES]; 262 | } 263 | } 264 | } 265 | 266 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 267 | if (!self.shouldAutoScrollSlider) 268 | return; 269 | 270 | if (self.sliderDirection == SliderDirectionHorizontal) { 271 | float x = scrollView.contentOffset.x + [self width]/2; 272 | float distance = 1000; 273 | int closest = -1; 274 | 275 | for (int i = 0; i < self.categoryViews.count; i++) 276 | { 277 | UIView *view = (UIView*)[self.categoryViews objectAtIndex:i]; 278 | 279 | if (abs(x - view.center.x) < distance) 280 | { 281 | distance = abs(x-view.center.x); 282 | closest = i; 283 | } 284 | } 285 | 286 | [self slideItemAtIndex:closest animated:YES]; 287 | } 288 | else if (self.sliderDirection == SliderDirectionVertical) { 289 | float y = scrollView.contentOffset.y + [self height]/2; 290 | float distance = 1000; 291 | int closest = -1; 292 | 293 | for (int i = 0; i < self.categoryViews.count; i++) 294 | { 295 | UIView *view = (UIView*)[self.categoryViews objectAtIndex:i]; 296 | 297 | if (abs(y - view.center.y) < distance) 298 | { 299 | distance = abs(y-view.center.y); 300 | closest = i; 301 | } 302 | } 303 | 304 | [self slideItemAtIndex:closest animated:YES]; 305 | } 306 | } 307 | 308 | 309 | 310 | @end 311 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | CategorySliderView.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /CategorySliderView/CategorySliderView.xcdatamodeld/CategorySliderView.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /CategorySliderView/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CategorySliderView/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CategorySliderView/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CategorySliderView/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import "TestViewController.h" 10 | #import "CategorySliderView.h" 11 | 12 | #define CategorySliderHeight 60 13 | 14 | @interface TestViewController () 15 | @property (nonatomic, strong) CategorySliderView *sliderView; 16 | @property (nonatomic, strong) CategorySliderView *verticalSlider; 17 | @end 18 | 19 | @implementation TestViewController 20 | 21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 22 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 23 | if (self) { 24 | // Custom initialization 25 | } 26 | return self; 27 | } 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | 32 | self.sliderView = [[CategorySliderView alloc] initWithSliderHeight:CategorySliderHeight andCategoryViews:@[[self labelWithText:@"First Category"], [self labelWithText:@"Second Category"], [self labelWithText:@"Yet another category"], [self labelWithText:@"and antoher category"]] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) { 33 | UILabel *selectedView = (UILabel *)categoryView; 34 | NSLog(@"\"%@\" cateogry selected at index %ld", selectedView.text, (long)categoryIndex); 35 | }]; 36 | 37 | [self.sliderView setBackgroundColor:[UIColor yellowColor]]; 38 | [self.sliderView setY:-CategorySliderHeight]; 39 | [self.sliderView moveY:20 duration:0.5 complation:nil]; 40 | [self.view addSubview:self.sliderView]; 41 | 42 | UIButton *addNewCat = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | [addNewCat setFrame:CGRectMake(10, 100, 300, CategorySliderHeight)]; 44 | [addNewCat setTitle:@"Add New Category" forState:UIControlStateNormal]; 45 | [addNewCat setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 46 | [addNewCat addTarget:self action:@selector(addNewCategory:) forControlEvents:UIControlEventTouchUpInside]; 47 | [self.view addSubview:addNewCat]; 48 | 49 | 50 | self.verticalSlider = [[CategorySliderView alloc] initWithFrame:CGRectMake(0, 130, 50, 300) andCategoryViews:@[[self labelWithText:@"cat1"], [self labelWithText:@"cat2"], [self labelWithText:@"cat3"], [self labelWithText:@"cat4"]] sliderDirection:SliderDirectionVertical categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) { 51 | UILabel *selectedView = (UILabel *)categoryView; 52 | NSLog(@"vertical \"%@\" cateogry selected at index %ld", selectedView.text, (long)categoryIndex); 53 | }]; 54 | [self.verticalSlider setBackgroundColor:[UIColor grayColor]]; 55 | [self.verticalSlider setX:-50]; 56 | [self.verticalSlider moveX:0 duration:0.5 complation:nil]; 57 | [self.view addSubview:self.verticalSlider]; 58 | } 59 | 60 | - (void)addNewCategory:(id)sender { 61 | [self.sliderView addCategoryView:[self labelWithText:@"New Category"]]; 62 | [self.verticalSlider addCategoryView:[self labelWithText:@"newcat"]]; 63 | } 64 | 65 | - (UILabel *)labelWithText:(NSString *)text { 66 | float w = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]}].width; 67 | 68 | UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, w, CategorySliderHeight)]; 69 | [lbl setFont:[UIFont systemFontOfSize:15]]; 70 | [lbl setText:text]; 71 | [lbl setTextAlignment:NSTextAlignmentCenter]; 72 | return lbl; 73 | } 74 | 75 | - (void)didReceiveMemoryWarning { 76 | [super didReceiveMemoryWarning]; 77 | // Dispose of any resources that can be recreated. 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /CategorySliderView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CategorySliderView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CategorySliderView 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CategorySliderViewTests/CategorySliderViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.questamobile.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CategorySliderViewTests/CategorySliderViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CategorySliderViewTests.m 3 | // CategorySliderViewTests 4 | // 5 | // Created by Cem Olcay on 04/07/14. 6 | // Copyright (c) 2014 questamobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CategorySliderViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CategorySliderViewTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CategorySliderViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014, Cem Olcay 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CategorySliderView 2 | ================== 3 | 4 | Horizontal or vertical slider view for choosing categories. Add any UIView type as category item view. Fully customisable 5 | 6 | Demo 7 | ==== 8 | ![alt tag](https://raw.githubusercontent.com/cemolcay/CategorySliderView/master/demo.gif) 9 | 10 | Install 11 | ------- 12 | 13 | **Manual** 14 | Copy CategorySliderView.h/m files into your project. 15 | 16 | **CocoaPods** 17 | 18 | ``` 19 | source 'https://github.com/CocoaPods/Specs.git' 20 | pod 'CategorySliderView', '~> 1.0.2' 21 | ``` 22 | 23 | Usage 24 | ----- 25 | 26 | UILabel *category1 = ...... 27 | UILabel *category2 = ...... 28 | UILabel *category3 = ...... 29 | ... 30 | 31 | CategorySliderView *sliderView = [[CategorySliderView alloc] initWithSliderHeight:60 andCategoryViews:@[category1, category2, category3] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) { 32 | UILabel *selectedView = (UILabel *)categoryView; 33 | NSLog(@"\"%@\" cateogry selected at index %d", selectedView.text, categoryIndex); 34 | }]; 35 | [self.view addSubview:sliderView]; 36 | 37 | 38 | you can add as many items as you want 39 | 40 | UIView *newCategoryView = ..... 41 | [sliderView addCategoryView:newCategoryView]; 42 | 43 | 44 | 45 | Optional Properties 46 | ------------------- 47 | 48 | shouldAutoScrollSlider: scrolls to closest category item after dragging ends 49 | shouldAutoSelectScrolledCategory: selects the closest category item after dragging ends 50 | categoryViewPadding: padding between category item views 51 | backgroundImage: background image for slider 52 | 53 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cemolcay/CategorySliderView/b18e5a4abf5e8a4009ba3706f9df98d10ac7aed5/demo.gif --------------------------------------------------------------------------------