slider view for choosing categories. add any UIView type as category item view. Fully customisable

Overview

CategorySliderView

Horizontal or vertical slider view for choosing categories. Add any UIView type as category item view. Fully customisable

Demo

alt tag

Install

Manual
Copy CategorySliderView.h/m files into your project.

CocoaPods

    source 'https://github.com/CocoaPods/Specs.git'
    pod 'CategorySliderView', '~> 1.0.2'

Usage

UILabel *category1 = ......
UILabel *category2 = ......
UILabel *category3 = ......
...

CategorySliderView *sliderView = [[CategorySliderView alloc] initWithSliderHeight:60 andCategoryViews:@[category1, category2, category3] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) {
    UILabel *selectedView = (UILabel *)categoryView;
    NSLog(@"\"%@\" cateogry selected at index %d", selectedView.text, categoryIndex);
}];
[self.view addSubview:sliderView];

you can add as many items as you want

UIView *newCategoryView = .....
[sliderView addCategoryView:newCategoryView];

Optional Properties

shouldAutoScrollSlider: scrolls to closest category item after dragging ends
shouldAutoSelectScrolledCategory: selects the closest category item after dragging ends
categoryViewPadding: padding between category item views
backgroundImage: background image for slider
Comments
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull requests corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    opened by ReadmeCritic 0
  • Swift error with NSContiguousString frame

    Swift error with NSContiguousString frame

    Hey, I'm having issues setting up the slider with swift.

         let listSlider = CategorySliderView.init(frame: CGRectMake(0 , 0, 60, self.view.frame.width),
                andCategoryViews: List.getAll(),
                sliderDirection: SliderDirection.Horizontal,
                categorySelectionBlock: { (categoryView: UIView!, index: Int) -> Void in
                    print("index: \(index)")
            })
    

    or

            let listSlider = CategorySliderView(sliderHeight: 60.0,
                andCategoryViews: List.getAll()) { (categoryView: UIView!, index: Int) -> Void in
                    print("index: \(index)")
            }
    

    Either way, I'm getting the error I'm getting below:

    2016-01-24 18:18:34.220 CelebrityScore[84554:3132239] -[Swift._NSContiguousString frame]: unrecognized selector sent to instance 0x7f84b3d46770
    2016-01-24 18:18:34.228 CelebrityScore[84554:3132239] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Swift._NSContiguousString frame]: unrecognized selector sent to instance 0x7f84b3d46770'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x0000000113111e65 __exceptionPreprocess + 165
        1   libobjc.A.dylib                     0x0000000112b8adeb objc_exception_throw + 48
        2   CoreFoundation                      0x000000011311a48d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
        3   CoreFoundation                      0x000000011306790a ___forwarding___ + 970
        4   CoreFoundation                      0x00000001131132d8 __forwarding_prep_1___ + 120
        5   CategorySliderView                  0x000000010f641c8a -[CategorySliderView addCategoryView:] + 618
        6   CategorySliderView                  0x000000010f641913 -[CategorySliderView initWithFrame:andCategoryViews:sliderDirection:categorySelectionBlock:] + 1603
        7   CelebrityScore                      0x000000010ee46b93 _TTOFCSo18CategorySliderViewcfMS_FT5frameVSC6CGRect16andCategoryViewsGSQGSaPSs9AnyObject___15sliderDirectionOSC15SliderDirection22categorySelectionBlockGSQFTGSQCSo6UIView_Si_T___GSQS__ + 499
        8   CelebrityScore                      0x000000010ee4588a _TFCSo18CategorySliderViewCfMS_FT5frameVSC6CGRect16andCategoryViewsGSQGSaPSs9AnyObject___15sliderDirectionOSC15SliderDirection22categorySelectionBlockGSQFTGSQCSo6UIView_Si_T___GSQS__ + 186
        9   CelebrityScore                      0x000000010ee3f039 _TFC14CelebrityScore20MasterViewControllercfMS0_FT9viewModelCS_17CelScoreViewModel_S0_ + 2153
        10  CelebrityScore                      0x000000010ee3f743 _TFC14CelebrityScore20MasterViewControllerCfMS0_FT9viewModelCS_17CelScoreViewModel_S0_ + 67
        11  CelebrityScore                      0x000000010ee39a1f _TFC14CelebrityScore11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 1663
        12  CelebrityScore                      0x000000010ee3a253 _TToFC14CelebrityScore11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179
        13  UIKit                               0x000000011153e1f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
        14  UIKit                               0x000000011153f397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
        15  UIKit                               0x0000000111545cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
        16  UIKit                               0x0000000111542e7b -[UIApplication workspaceDidEndTransaction:] + 188
        17  FrontBoardServices                  0x00000001183f7754 -[FBSSerialQueue _performNext] + 192
        18  FrontBoardServices                  0x00000001183f7ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        19  CoreFoundation                      0x000000011303da31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        20  CoreFoundation                      0x000000011303395c __CFRunLoopDoSources0 + 556
        21  CoreFoundation                      0x0000000113032e13 __CFRunLoopRun + 867
        22  CoreFoundation                      0x0000000113032828 CFRunLoopRunSpecific + 488
        23  UIKit                               0x00000001115427cd -[UIApplication _run] + 402
        24  UIKit                               0x0000000111547610 UIApplicationMain + 171
        25  CelebrityScore                      0x000000010ee3b50d main + 109
        26  libdyld.dylib                       0x000000011490192d start + 1
    

    How would you recommend to set up the slider in swift?

    opened by GreyEcologist 0
  • Swift Code

    Swift Code

    Hi, I've been trying to translate this tiny part of code into Swift.. can someone help?

    CategorySliderView *sliderView = [[CategorySliderView alloc] initWithSliderHeight:60 andCategoryViews:@[category1, category2, category3] categorySelectionBlock:^(UIView *categoryView, NSInteger categoryIndex) { UILabel *selectedView = (UILabel *)categoryView; NSLog(@""%@" cateogry selected at index %d", selectedView.text, categoryIndex); }];

    opened by jacobokoenig 0
  • Setting backgroundColor

    Setting backgroundColor

    Hi,

    I'm unable to set the backgroundColor of an initialized CategorySliderView. This code doesn't work and the view still has a yellow background, is there a trick to setting the background color or am I missing something?

    [self.sliderView setBackgroundColor:[UIColor redColor]];

    I found where this is hardcoded to yellow in the .m file, would you take a pull request to add setting the bgColor to the initWithFrame.... initializer like:

    - (instancetype)initWithFrame:(CGRect)frame andCategoryViews:(NSArray *)categoryViews sliderDirection:(SliderDirection)direction categorySelectionBlock:(categorySelected)block withBackgroudColor:(UIColor *)bgColor;

    EDIT:
    I discovered that if I remove line 53: https://github.com/cemolcay/CategorySliderView/blob/master/CategorySliderView/CategorySliderView.m#L53 I'm able to set the backgroundColor in my instantiated CategorySlider. I'm happy to create a pull request to remove the [self.scrollView setBackgroundColor:[UIColor yellowColor]]; line and/or create an initializer. Let me know if you have a preference

    opened by sandalsoft 1
  • Updating Buttons

    Updating Buttons

    If the user needs updated buttons showing x followers each time the user enters his/hers profile and that x value is fetched async from the web in viewWillAppear, how can you then update the button with the value x when the callback comes in? In other words, how can you update the buttons after they first have been laid out?

    Thank you for your time Alexander

    opened by AlexanderNorway 2
Releases(v1.0.2)
Owner
Cem Olcay
iOS Developer
Cem Olcay
Quick Symlink - a Finder extension which provides a contextual menu item for the symbolic links creation on macOS

Quick Symlink The Quick Symlink is a Finder extension which provides a contextual menu item for the symbolic links (and other links) creation on macOS

Alexander Kropotin 29 Dec 20, 2022
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Tung Vo 290 Nov 13, 2022
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

Cali Castle 1.5k Dec 30, 2022
Panels is a framework to easily add sliding panels to your application

Panels is a framework to easily add sliding panels to your application. It takes care of the safe area in new devices and moving your panel when the k

Antonio Casero 1.5k Dec 14, 2022
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

▤ SideMenu If you like SideMenu, give it a ★ at the top right of this page. SideMenu needs your help! If you're a skilled iOS developer and want to he

Jon Kent 5.4k Dec 29, 2022
BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

Daniel Saidi 174 Jan 2, 2023
You can easily add awesome animated context menu to your app.

Context-Menu.iOS You can easily add awesome animated context menu to your app. Made in Check this [project on dribbble] (https://dribbble.com/shots/17

Yalantis 1.8k Nov 17, 2022
🔻 Dropdown Menu for iOS with many customizable parameters to suit any needs

MKDropdownMenu Dropdown Menu for iOS with many customizable parameters to suit any needs. Inspired by UIPickerView. Installation CocoaPods MKDropdownM

Max Konovalov 531 Dec 26, 2022
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

Unfortunately, life gets in the way sometimes and I won't be able to maintain this library any longer and upgrade this library to where it needs to be

null 5.2k Dec 31, 2022
XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers

XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers. Pan gesture can be used to move on to next or previous view controller. It shows a interactive indicator of the current, previous, next child view controllers.

xmartlabs 6.8k Dec 27, 2022
Interactive view transition to display menus with flowing and bouncing effects in Swift

FlowingMenu FlowingMenu provides an interactive transition manager to display menu with a flowing and bouncing effects. The Objective-C countepart is

Yannick Loriot 975 Dec 21, 2022
An easy to use and setup floating view for your app. 🎡

HHFloatingView An easy to use and setup floating view for your app. ?? Installation Manually - Add HHFloatingView/Source folder to your Project. And y

Hemang 95 Dec 15, 2022
Drawer view controller that easy to use!

KWDrawerController Drawer view controller that is easy to use! Installation CocoaPods (iOS 8+ projects) KWDrawerController is available on CocoaPods.

Jungwon An 157 Jun 14, 2022
A paging view controller with a highly customizable menu ✨

Getting Started | Customization | Installation Features Parchment lets you page between view controllers while showing any type of generic indicator t

Martin Rechsteiner 3k Jan 8, 2023
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Yuji Hato 3.3k Dec 29, 2022
Swipable tab and menu View and ViewController.

SwipeMenuViewController Overview SwipeMenuViewController provides SwipeMenuView and SwipeMenuViewController. This is very useful to build swipe-based

Yusuke Morishita 1.2k Dec 29, 2022
Mac menu bar tool to view the architecture of the running application

Silicon Info About Silicon Info is a tiny menu bar application allows the user to quickly view the architecture of the currently running application.

William Castelli (Billy) 260 Dec 29, 2022
Simple example of view that appears on tap button and dismiss with swipe gesture.

MenuWithSlide Simple SwiftUI example of how to show side menu with slide effect. On button press - appeares, on background tap or swipe right - dissmi

Evgeny 1 Nov 29, 2021