GithubHelp home page GithubHelp logo

shmultipleselect's Introduction

SHMultipleSelect

SHMultipleSelect is an easy-to-use multiple selection view for iOS 7.0+.

Created by Shamsiddin https://www.linkedin.com/in/shamsiddin

Installation

Cocoapods

SHMultipleSelect is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SHMultipleSelect", "~> 0.2.2"

Manually

  • Copy class files from Pod/Classes folder to your project

Usage

  • Import SHMultipleSelect.h and implement SHMultipleSelectDelegate protocol
  • See Demo project for more details

Delegate methods

- (void)multipleSelectView:(SHMultipleSelect*)multipleSelectView clickedBtnAtIndex:(NSInteger)clickedBtnIndex withSelectedIndexPaths:(NSArray*)selectedIndexPaths;
- (NSString*)multipleSelectView:(SHMultipleSelect*)multipleSelectView titleForRowAtIndexPath:(NSIndexPath*)indexPath;
- (BOOL)multipleSelectView:(SHMultipleSelect*)multipleSelectView setSelectedForRowAtIndexPath:(NSIndexPath*)indexPath;
#pragma mark - SHMultipleSelectDelegate

- (void)multipleSelectView:(SHMultipleSelect *)multipleSelectView clickedBtnAtIndex:(NSInteger)clickedBtnIndex withSelectedIndexPaths:(NSArray *)selectedIndexPaths {
    if (clickedBtnIndex == 1) { // Done btn
        for (NSIndexPath *indexPath in selectedIndexPaths) {
            NSLog(@"%@", _dataSource[indexPath.row]);
        }
    }
}

- (NSString *)multipleSelectView:(SHMultipleSelect *)multipleSelectView titleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return _dataSource[indexPath.row];
}

- (BOOL)multipleSelectView:(SHMultipleSelect *)multipleSelectView setSelectedForRowAtIndexPath:(NSIndexPath *)indexPath {
    BOOL canSelect = NO;
    if (indexPath.row == _dataSource.count - 1) { // last object
        canSelect = YES;
    }
    return canSelect;
}

ARC

SHMultipleSelect uses ARC (Automatic Reference Counting).

If you are using SHMultipleSelect in your non-arc project, you will need to set a -fobjc-arc compiler flag on all of the SHMultipleSelect source files.

To set a compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Now select all SHMultipleSelect source files, press Enter, insert -fobjc-arc and then "Done" to disable ARC for SHMultipleSelect.

Uses Frameworks

  • UIKit.framework
  • Foundation.framework
  • QuartzCore.framework

License

SHMultipleSelect is available under the MIT license. See the LICENSE file for more info.

shmultipleselect's People

Contributors

shamsiddin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shmultipleselect's Issues

How can we select all with an option of All in list...

How can we select all with an option of All in list. I know i can pre select all items by using delegate - (BOOL)multipleSelectView:(SHMultipleSelect*)multipleSelectView setSelectedForRowAtIndexPath:(NSIndexPath*)indexPath
But i just want to select all when user select All option from top of the list...

Autolayout with SHMultipleSelect

Hi

I am using autolayout in my project and I want exactly the same feature as provided by SHMultipleSelect but I think it doesn't support autolayout constraints. I tried to add constraint through code but it gives the following error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'

The issue comes while rotating the device, the view gets distorted.

Can you please add autolayout support to this? That would really be very helpful.

Thanks

Duplicate symbols for architecture x86_64 error

duplicate symbol _OBJC_IVAR_$_SHMultipleSelect._coverView in:
~/Xcode/DerivedData/../Build/Products/Debug-iphonesimulator/libSHMultipleSelect.a(SHMultipleSelect.o)

App is failing to build with "14 duplicate symbol for arch x86_64" linker error..

I have used following command in pod file
pod 'SHMultipleSelect', '~> 0.2.2'

Pls help..

selected indexes & retaining selection

it would be great if we can load the selected indexes, now we can only select items and after the the control is dismissed the selection is not retained

Need Help

How to hide popupview without done button click while shown.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.