https://github.com/rushisangani/rsselectionviewcontroller
A powerful control to select and search from the list like dropdown in android
https://github.com/rushisangani/rsselectionviewcontroller
Last synced: 7 months ago
JSON representation
A powerful control to select and search from the list like dropdown in android
- Host: GitHub
- URL: https://github.com/rushisangani/rsselectionviewcontroller
- Owner: rushisangani
- Created: 2016-06-12T09:38:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-25T11:22:06.000Z (about 9 years ago)
- Last Synced: 2025-01-20T09:26:17.968Z (9 months ago)
- Language: Objective-C
- Homepage:
- Size: 154 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RSSelectionViewController
A powerful control to select items from the list like dropdown in Android. Save time by avoding boilerplate code in your project for search and selection screen.
**RSSelectionViewController** can be used as a ViewController in which user can select **single/multiple** items, **search** through the list and get selected item as **string** to display results.
 
 
## Features
- **Present/Push/PopOver** RSSelectionViewController as per need.
- Enable multiple selection using single property **allowMultipleSelection**.
- Enable search funtionality using single property **allowSearch**.
- Allow empty selection when you don't want to select anything by using single property **allowEmptySelection**.
- Customizable NavigationBar, and Buttons color etc.
- Customizable SarchBar place holder, color etc.
- Get selected items as a string to display using delegate method.## How To Use
### Single Selection
```objective-c
RSSelectionViewController *selectionController = [[RSSelectionViewController alloc] initWithNibName:NSStringFromClass([RSSelectionViewController class]) bundle:nil];/* pass array as a dataSource, array of selected objects if any and identifier if required */
[selectionController setDataArray:dataArray selectedObjects:selectedArray andDelegate:self forIdentifier:identifier];/* set title if required */
selectionController.navigationTitle = @"Select Name";[self.navigationController pushViewController:selectionController animated:YES];
```### Multiple Selection
```objective-c
RSSelectionViewController *selectionController = [[RSSelectionViewController alloc] initWithNibName:NSStringFromClass([RSSelectionViewController class]) bundle:nil];/* pass array as a dataSource, array of selected objects if any and identifier if required */
[selectionController setDataArray:dataArray selectedObjects:selectedArray andDelegate:self forIdentifier:identifier];/* pass keyname to display row title if dataArray contains dictionary */
selectionController.dataAccessKey = @"key_name";/* enable multiple selection */
selectionController.allowMultipleSelection = YES;/* set custom seperator */
selectionController.seperator = @" |";[self.navigationController pushViewController:selectionController animated:YES];
```### Selection with Search
```objective-c
RSSelectionViewController *selectionController = [[RSSelectionViewController alloc] initWithNibName:NSStringFromClass([RSSelectionViewController class]) bundle:nil];/* pass array as a dataSource, array of selected objects if any and identifier if required */
[selectionController setDataArray:dataArray selectedObjects:selectedArray andDelegate:self forIdentifier:identifier];/* set title if required */
selectionController.navigationTitle = @"Select Name";/* enable search */
selectionController.allowSearch = YES;/* set searchBar placeholder if required */
selectionController.searchPlaceHolder = @"Search Name";[self.navigationController pushViewController:selectionController animated:YES];
```### Get Selected Data using delegate method
```objective-c
#pragma mark- RSSelectionDelegate methods- (void)getSelectedObjects:(NSArray *)selectedObjects andConcatenatedString:(NSString *)string forIdentifier:(NSString *)identifier {
/* replace previous selected objects with new objects */
[selectedArray setArray:selectedObjects];
/* display selected objects as a concatenated string */
self.label.text = string;
}- (void)getSearchedText:(NSString *)searchedText forIdentifier:(NSString *)identifier {
// get text typed in searchBar
}
```## License
RSSelectionViewController is released under the MIT license. See LICENSE for details.