Skip to content

JoeyPinilla/ActionSheetPicker-3.0

 
 

Repository files navigation

Version Build Status License Platform Issues

ActionSheetPicker-3.0

Please welcome: ActionSheetPicker-3.0!

pod 'ActionSheetPicker-3.0', '~> 1.5.0' (iOS 6-7-8 compatible!)

Improvements more than welcome - they are kindly requested :)

Regards, Petr Korolev

##ActionSheetPicker = UIPickerView + UIActionSheet ##

Animation

Well, that's how it started. Now, the following is more accurate:

  • iPhone/iPod ActionSheetPicker = ActionSheetPicker = A Picker + UIActionSheet
  • iPad ActionSheetPicker = A Picker + UIPopoverController

Overview

Easily present an ActionSheet with a PickerView, allowing user to select from a number of immutable options.

Benefits

  • Spawn pickers with convenience function - delegate or reference not required. Just provide a target/action callback.
  • Add buttons to UIToolbar for quick selection (see ActionSheetDatePicker below)
  • Delegate protocol available for more control
  • Universal (iPhone/iPod/iPad)

QuickStart

There are 4 distinct picker view options: ActionSheetStringPicker, ActionSheetDistancePicker, ActionSheetDatePicker, and ActionSheetCustomPicker. We'll focus here on how to use the ActionSheetStringPicker since it's most likely the one you want to use.

Basic Usage

For detailed examples, please look Wiki-page and check Example Projects in this repo.

// Inside a IBAction method:

// Create an array of strings you want to show in the picker:
NSArray *colors = [NSArray arrayWithObjects:@"Red", @"Green", @"Blue", @"Orange", nil];

[ActionSheetStringPicker showPickerWithTitle:@"Select a Color"
                                        rows:colors
                            initialSelection:0
                                   doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
                                      NSLog(@"Picker: %@", picker);
                                      NSLog(@"Selected Index: %@", selectedIndex);
                                      NSLog(@"Selected Value: %@", selectedValue);
                                    }
                                 cancelBlock:^(ActionSheetStringPicker *picker) {
                                      NSLog(@"Block Picker Canceled");
                                    }
                                      origin:sender];
// You can also use self.view if you don't have a sender

##Installation##

  • The most easiest way is through Cocoapods. Just add to your Podfile string: pod 'ActionSheetPicker-3.0'

  • The "old school" way is manually add to your project all from Pickers folder and import necessary headers.

Example Projects##

open Example.xcworkspace

Here is 4 projects:

  • CoreActionSheetPicker - all picker files combined in one Framework. (available since iOS 8)
  • ActionSheetPicker - modern and descriptive Obj-C project with many examples.
  • Swift-Example - example, written on Swift. (only with basic 3 Pickers examples, for all examples please run ActionSheetPicker project)
  • ActionSheetPicker-iOS6-7 - iOS 6 and 7 comparable project. or to run only this project open Example-for-and-6/ActionSheetPicker.xcodeproj

Screenshots

ActionSheetPicker ActionSheetDatePicker ActionSheetDatePicker CustomButtons iPad Support

If you are using ActionSheetPicker-3.0 in your app or know of an app that uses it, please add it to [this] (https://github.com/skywinder/ActionSheetPicker-3.0/wiki/Apps-using-ActionSheetPicker-3.0) list.

Maintainer and Contributor

  • Petr Korolev (update to iOS 7 and iOS 8, implementing new pickers, community support)

Credits

  • ActionSheetPicker was originally created by Tim Cinel (@TimCinel) Since the Tim's repo is not support iOS 7+, I forked from his repo and implement iOS 7-8 support, and also bunch of UI fixes, crash-fixes and different customisation abilities.

  • And most of all, thanks to ActionSheetPicker-3.0's growing list of contributors.

Contributing

  1. Create an issue to discuss about your idea
  2. Fork it (https://github.com/skywinder/ActionSheetPicker-3.0/fork)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Bug reports, feature requests, patches, well-wishes, and rap demo tapes are always welcome.

Analytics

Bitdeli Badge

About

Quickly reproduce the dropdown UIPickerView / ActionSheet functionality on iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.8%
  • Swift 4.1%
  • Other 1.1%