Coder Social home page Coder Social logo

fred30 / actionsheetpicker-3.0 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skywinder/actionsheetpicker-3.0

0.0 2.0 0.0 10.55 MB

Quickly reproduce the dropdown UIPickerView / ActionSheet functionality on iOS.

Home Page: http://skywinder.github.io/ActionSheetPicker-3.0

License: BSD 3-Clause "New" or "Revised" License

Ruby 0.38% Objective-C 95.97% Swift 3.64%

actionsheetpicker-3.0's Introduction

Version Carthage compatible Build Status Issues License Platform

ActionSheetPicker-3.0

Please welcome: ActionSheetPicker-3.0!

pod 'ActionSheetPicker-3.0', '~> 2.0.1' (iOS 5.1.1-8.x compatible!)

##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 info about customisations, please look BASIC USAGE

  • custom buttons view
  • custom buttons callbacks
  • Action by clicking outside of the picker
  • Other customisations

For detailed examples, please 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: %@, Index: %@, value: %@", 
                                      picker, selectedIndex, selectedValue);
                                    }
                                 cancelBlock:^(ActionSheetStringPicker *picker) {
                                      NSLog(@"Block Picker Canceled");
                                    }
                                      origin:sender];
// You can also use self.view if you don't have a sender

##Installation##

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

You can install it with the following command:

$ gem install cocoapods

To integrate ActionSheetPicker-3.0 into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

pod 'ActionSheetPicker-3.0'

Then, run the following command:

$ pod install

Import to project

To import pod you should add string:

  • For Obj-c projects:

      #import "ActionSheetPicker.h"
    
  • For Swift projects:

      import ActionSheetPicker_3_0
    

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ActionSheetPicker-3.0 into your Xcode project using Carthage, specify it in your Cartfile:

github "skywinder/ActionSheetPicker-3.0"

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate ActionSheetPicker-3.0 into your project manually.

The "old school" way is manually add to your project all from Pickers folder.

Embedded Framework

  • Add ActionSheetPicker-3.0 as a submodule by opening the Terminal, cd-ing into your top-level project directory, and entering the following command:
$ git submodule add https://github.com/skywinder/ActionSheetPicker-3.0.git
  • Open the ActionSheetPicker-3.0 folder, and drag CoreActionSheetPicker.xcodeproj into the file navigator of your app project.
  • In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
  • Ensure that the deployment target of CoreActionSheetPicker.framework matches that of the application target.
  • In the tab bar at the top of that window, open the "Build Phases" panel.
  • Expand the "Target Dependencies" group, and add CoreActionSheetPicker.framework.
  • Click on the + button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add CoreActionSheetPicker.framework.

Example Projects##

open ActionSheetPicker-3.0.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've used this project in a live app, please let me know! Nothing makes me happier than seeing someone else take my work and go wild with it.

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

actionsheetpicker-3.0's People

Contributors

skywinder avatar timcinel avatar kashifhisam avatar delackner avatar perezpaya avatar ainopara avatar johnnyg avatar grgcombs avatar nimuzak avatar jack-s avatar markrickert avatar tonsilver avatar venj avatar ecordell avatar stupergenius avatar mau04 avatar michalciolek avatar emmanuelay avatar tbaranes avatar 0xmark avatar nowsprinting avatar jklp avatar jkrzemie avatar brettg avatar jaseelder avatar jeffreyjackson avatar jparise avatar nebiros avatar mgmart avatar elwerene avatar

Watchers

James Cloos avatar  avatar

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.