Giter VIP home page Giter VIP logo

skywinder / actionsheetpicker-3.0 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from timcinel/actionsheetpicker

3.4K 92.0 737.0 12.43 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

Objective-C 92.96% Swift 6.39% Ruby 0.66%
ios actionsheet picker pickerview picker-dialogs picker-component hacktoberfest

actionsheetpicker-3.0's Introduction

ActionSheetPicker-3.0

Version Carthage compatible Build Status Issues License Platform All Contributors

Important update

Now I fixed most of the things and merge PR' (thanks to All Contributors).

I did much work to support this library from iOS 5. (and till iOS 13 and we keep going) 🚀

I still need help with the future support of this repo. If you are interested to help - please drop a comment into issue #348 🙏

Regards, Petr Korolev


Please welcome: ActionSheetPicker-3.0!

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 the 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
  • 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 customizations, please look BASIC USAGE

  • Custom buttons view
  • Custom buttons callbacks
  • Action by clicking outside of the picker
  • Background color and blur effect
  • Other customizations

For detailed examples, please check Example Projects in this repo.

Swift

 ActionSheetMultipleStringPicker.show(withTitle: "Multiple String Picker", rows: [
            ["One", "Two", "A lot"],
            ["Many", "Many more", "Infinite"]
            ], initialSelection: [2, 2], doneBlock: {
                picker, indexes, values in

                print("values = \(values)")
                print("indexes = \(indexes)")
                print("picker = \(picker)")
                return
        }, cancel: { ActionMultipleStringCancelBlock in return }, origin: sender)

Objective-C

// Inside a IBAction method:

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

// Done block:
    ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
        NSLog(@"Picker: %@", picker);
        NSLog(@"Selected Index: %@", @(selectedIndex));
        NSLog(@"Selected Value: %@", selectedValue);
    };


// cancel block:
    ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
        NSLog(@"Block Picker Canceled");
    };

// Run!
    [ActionSheetStringPicker showPickerWithTitle:@"Select a Color" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];

Installation

CocoaPods

pod 'ActionSheetPicker-3.0'

(iOS 5.1.1-13.x compatible!)

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"

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into Xcode and the Swift compiler.

If you are using Xcode 11 or later:

  1. Click File
  2. Swift Packages
  3. Add Package Dependency...
  4. Specify the git URL for ActionSheetPicker-3.0.
https://github.com/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 added 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 3 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)

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 list.

Maintainer and Contributor

  • Petr Korolev (update to iOS 7 and iOS 8, implementing new pickers, community support). I did much work to support this library from iOS 5. (and till iOS 13 and we keep going 🚀).

Now I fixed most of the things and merge PR' (thanks to All Contributors!).

I still need help with the future support of this repo. If you are interested to help - please drop a comment into issue #348 🙏

Contributing

  1. Create an issue to discuss 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.

Discord

We have a Discord channel where discuss about new ideas and implementation. Feel free to join and discuss with us!

You can join our Discord using this link.

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 a bunch of UI fixes, crash-fixes, and different customization abilities.

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

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Petr Korolev
Petr Korolev

💻 👀 💬 💡
Tim Cinel
Tim Cinel

💻 👀 📖
Jurģis Ķiršakmens
Jurģis Ķiršakmens

💬 💡
Nikos
Nikos

📖
Vinh Tran
Vinh Tran

💻 🛡️
Kashif Hisam
Kashif Hisam

💻
DYY_Xiaoer
DYY_Xiaoer

💻 🛡️
Seth Delackner
Seth Delackner

💻
Zheng Li
Zheng Li

💻
Andrea
Andrea

💬 💻 🖋 🚧
Bino90
Bino90

💻
arnoldxt
arnoldxt

💻
Koji Hasegawa
Koji Hasegawa

🚇
Ali Ersoz
Ali Ersoz

💻
KAWASHIMA Yoshiyuki
KAWASHIMA Yoshiyuki

📖
Ricardo Hernandez
Ricardo Hernandez

💻
Vincent Narbot
Vincent Narbot

📖
Ezequiel França
Ezequiel França

📖
Nikola Mladenovic
Nikola Mladenovic

📖
Umer Asif
Umer Asif

🐛
longjun
longjun

💻
Manuel Kunz
Manuel Kunz

💻 👀 📖
Noor ul Ain Ali
Noor ul Ain Ali

💻 👀 🚧
Wei
Wei

🚇 👀 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

actionsheetpicker-3.0's People

Contributors

ainopara avatar allcontributors[bot] avatar andreabusi avatar cutmail avatar delackner avatar ecordell avatar elfsundae avatar emmanuelay avatar grgcombs avatar jack-s avatar johnnyg avatar kashifhisam avatar markrickert avatar mau04 avatar michalciolek avatar mlch911 avatar nikola-mladenovic avatar nimuzak avatar nowsprinting avatar palmtrae avatar perezpaya avatar skywinder avatar sschale avatar stupergenius avatar tbaranes avatar timcinel avatar tonsilver avatar venj avatar wei18 avatar xjki 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  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

actionsheetpicker-3.0's Issues

iOS 5.1.1 random crashes

i found a weird issue, after upgraded to actionsheetpicker 3.0, everything is fine on iOS6, iOS7 and iOS8. Every parameter is fine and it was perfectly working fine with pervious version of ActionSheetPicker. however, with 3.0 on iOS5.1.1, i used it on three places(ActionSheetStringPicker), two places of three pickers i used will crash when i click no matter done or cancel in the action sheet. without any error or warning, and further, i couldn't enter the page with that picker anymore until i restart the app(still without any warning). any idea?

Use with UITableViewCells

Hey there,
I tried to run this together with a UITableViewCell (didSelectRowAtIndexPath). This is not possible since I get an NSInternalInconsistencyException with the reason "Invalid origin provided to ActionSheetPicker". Is there a way to run this project with a UITableViewCell?

Crash when using in 5s iOS 7.1

crash in
ActionSheetDistancePicker.m

line 120

if ([target respondsToSelector:action])
objc_msgSend(target, action, [NSNumber numberWithInteger:(NSInteger)bigUnits], [NSNumber numberWithInteger:(NSInteger)smallUnits], origin);

Show from a presented view controller

Thanks for a great control!

I'm not able to show the picker from a view that has been presented modally:

ProfileTableViewController *profileViewController = [[ProfileTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:profileViewController];

[self presentViewController:navigationController animated:YES completion:^{}];

After profileViewController is in the forefront of the screen, whenever I try to show an ActionSheetPicker, it shows itself behind the profileViewController view (that was presented modally with the code above).

This is how I show the ActionSheetPicker:

                ActionSheetDatePicker *datePicker = [[ActionSheetDatePicker alloc] initWithTitle:@"Select Date of Birth" datePickerMode:UIDatePickerModeDate selectedDate:[NSDate date] target:self action:@selector(dateWasSelected:element:) origin:[self.tableView cellForRowAtIndexPath:indexPath] cancelAction:@selector(datePickerCancelled)];
                [datePicker setCancelButton:[[UIBarButtonItem alloc] initWithTitle:@"Cancel"  style:UIBarButtonItemStylePlain target:self action:@selector(datePickerCancelled)]];

                [datePicker showActionSheetPicker];

ActionSheetStringPicker error

Receiving following error in iOS7

ActionSheetPicker-3.0/ActionSheetStringPicker.h:31:15: Typedef redefinition with different types ('void (^)(ActionSheetStringPicker *__strong, NSInteger, __strong id)' vs 'void (^)(ExpireMonthYearActionSheetPicker *__strong, NSString *__strong, NSString *__strong)')

with using your example code :

    NSArray *colors = [NSArray arrayWithObjects:@"Red", @"Green", @"Blue", @"Orange", nil];

    [ActionSheetStringPicker showPickerWithTitle:@"Select a Color"
                                            rows:colors
                                initialSelection:0
                                       doneBlock:nil
                                     cancelBlock:nil
                                          origin:self];

Selected Row color

Hi
How to customize selected row ?
Maybe this feature not exists , can you add ?
Thank you

Xcode 6.0b2 Pickers Don't work.

Has anyone noticed that the Actionsheet pickers don't show up at all on Xcode 6.0b2? I like Xcode 6 better than 5, but if I compile (even to IOS7) I'm getting a little blank box at the bottom of the screen.

Any Ideas?

screen shot 2014-06-29 at 8 37 29 pm

not working on ios8 iphone 6

The same code works on ios8 iphone 5 but doesn`t work on iphone 6 ( begins but it hides automatically).
iphone 5:http://youtu.be/DEKviPhG-Ds
iphone 6: http://youtu.be/tTsTJuUW7lY

the code is:

ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {

    citaaux=xmlhorasparser.horas[selectedIndex];
    [btHora setTitle:citaaux.m_hora forState:UIControlStateNormal];



};
ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {

};
[ActionSheetStringPicker showPickerWithTitle:@"" rows:xmlhorasparser.horastexto initialSelection:0 doneBlock:done cancelBlock:cancel origin:btHora];

NSDate from TimePicker is 4 hours later than selected

I followed the code in your example to implement a time picker and here is my code:

-(void)selectATime:(id)sender {
    NSInteger minuteInterval = 5;
    NSInteger referenceTimeInterval = (NSInteger)[self.selectedTime timeIntervalSinceReferenceDate];
    NSInteger remainingSeconds = referenceTimeInterval % (minuteInterval * 60);
    NSInteger timeRoundedToFiveMinutes = referenceTimeInterval - remainingSeconds;
    if (remainingSeconds > ((minuteInterval * 60) / 2)) {
        timeRoundedToFiveMinutes = referenceTimeInterval + ((minuteInterval * 60) - remainingSeconds);
    }
    self.selectedTime = [NSDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)timeRoundedToFiveMinutes];

    ActionSheetDatePicker *datePicker = [[ActionSheetDatePicker alloc] initWithTitle:@"Select a time" datePickerMode:UIDatePickerModeTime selectedDate:self.selectedTime target:self action:@selector(timeWasSelected:element:) origin:sender];
    datePicker.minuteInterval = minuteInterval;
    [datePicker showActionSheetPicker];
}

-(void)timeWasSelected:(NSDate *)selectedTime element:(id)element {
    self.selectedTime = selectedTime;
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"h:mm a"];
    self.timeLabel.text = [dateFormatter stringFromDate:selectedTime];
    [self.timeLabel sizeToFit];
    NSLog(@"%@", self.selectedTime);
}

Using the selector, I pick 4:00 AM and the label that I have successfully shows 4:00 AM, however, when I log self.selectedTime or selectedTime within timeWasSelected, the time outputted is 4 hours greater than it should be. For 4:00 AM, I get this printout: 2014-10-08 08:00:00 +0000. Clearly 8 AM /= 4 AM

DatePicker callback freezes screen

The date time picker shows up when clicked on a button in a tableview cell. when selected a date, the picker disappeared and everything got frozen. touching and clicking did not work on the screen.

any ideas?

selectedDate on ActionSheetDatePicker's done block is buggy

Steps to recreate:

  1. Launch an ActionSheetDatePicker with UIDatePickerModeTime as mode and 10 minutes as interval. Do it at a time where the minutes is not divisible by 10, like 11:43.
  2. Date picker should show a preselected time according to the minute interval, like 11:50, or 12:00, or 12:10. It is important that you do not change the value of the date picker.
  3. Hit Done. Inspect the value of selectedDate on the doneBlock.

Expected result: selectedDate should return the preloaded value, like 11:50 or 12:00
Actual result: selectedDate has a value with the minutes similar to the phone's clock, like 11:53 or 12:03

Workaround:

- (void)clampDatePickerUsingMinuteInterval:(NSInteger)minuteInterval
{
    UIDatePicker *datePicker = (UIDatePicker *)self.pickerView;

    NSCalendar* calendar = [NSCalendar currentCalendar];
    NSDateComponents* components = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:datePicker.date];
    NSInteger minutes = [components minute];

    NSInteger remainder = minutes % minuteInterval;
    if(remainder)
    {
        minutes -= remainder;
        [components setMinute:minutes];
        datePicker.date = [calendar dateFromComponents:components];
    }

}

So instead of getting the value from selectedDate, I get it from pickerView.date.

ActionSheetStringPicker not showing on iphone

First i was using a year or so the orginal project from Tim Cinel. Now because of iOS 8 i updated to your 3.0 project.

But, the simple sample didn't show up in my app. I discovered that the problem is with the parent View. The picker was added as a view to my rootViewController, which was not actually visible at that time, so the picker was bellow my current UIViewController and so the user was unable to see him.

I decided to implement a quick workaround in SWActionSheet.m changing the line 39 from:
_origin = (keyWindow.rootViewController ? keyWindow.rootViewController.view : keyWindow);

to:
_origin = keyWindow;

Now the picker shows up on all my devices and simulator. Tested on iOS 6, 7, 8 with iPad and iPhone.

I don't know if this workaround is good or bad but it works for me. Maybe should you fix this. Tim Cinel's code was working in my app, he added the picker to the containerView like that:
origin = (_containerView.superview ? _containerView.superview : _containerView);

P.S. Thank you for the code, its perfect backward compatible to iOS 6(thats what i need) and saved me a lot of time.

Regards,
Primoz

Issue with iOS 8 beta

Compatibility issues still exists after forking project. Just putting this here for tracking purposes.

Problems running sample project (No visible @interface)

Hi there,

I have problems to run your samples. I pulled your ActionSheetPicker project and opened Example.xcworkspace with XCode 6.1 beta (6A1030). Right after that I see compile errors:

/tmp/ActionSheetPicker-3.0-master/Pickers/DistancePickerView.m:176:31: No visible @interface for 'DistancePickerView' declares the selector 'insertSubview:atIndex:'

The referenced line is:

[self insertSubview:label atIndex:0];

Do you have an idea what I'm doing wrong?

Regards, Leif

Using ActionSheetDatePicker as CountDownTimer-Picker

I tried to use the ActionSheetDatePicker in CountDownTimer mode.

// let selectedDate = NSDate(timeIntervalSince1970: NSTimeInterval(600))
let selectedDate = NSDate(timeIntervalSinceReferenceDate:  NSTimeInterval(600))
var datePicker = ActionSheetDatePicker(title: "Time Interval", datePickerMode: UIDatePickerMode.CountDownTimer, selectedDate: selectedDate, target: self, action: "datePicked:", origin: self.view)

datePicker.minuteInterval = 10
datePicker.showActionSheetPicker()

I would expect the DatePicker to be preset at 0h and 10min but it is preset at 1h 10min

More important I assume the function datePicked is called by ActionSheetDatePicker with a NSNumber instead of a NSDate. The number / date is most of the time 60, regardless of the selection I make in the picker.

Xcode 6 / Swift incompatibility

Hi Petr,

I don't know if it is a real issue or perhaps i'm doing something wrong, but I was not able to integrate this cocoapod with my swift project. Basically after you install a pod to the project and add reference to the bridge header of the project, it fails to compile on all the UI (eg. UIView) class references inside .h files within a pod, complaining that it is unknown type. Do you know what could cause such a behavior, is it a bug in podspec? It there anything you can suggest for me to look at?

PS> I didn't find a place to post questions, so posting it as an issue which very well could turn not to be

Thanks,
Artem

done button color

I used code below, but by donebutton text color is still white.. Whatever I tried, couldnt changed done button color from white to another color.. Problem exitsts on both ios8 and ios7..

    ActionSheetDatePicker* actionSheetPicker = [[ActionSheetDatePicker alloc] initWithTitle:@"" datePickerMode:UIDatePickerModeDate selectedDate:self.selectedDate target:self action:nil origin:textField];
    UIBarButtonItem* doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Tamam4234" style:UIBarButtonItemStyleBordered target:nil action:nil];

    [doneButton setTintColor:G_BLACK];
    [actionSheetPicker setDoneButton:doneButton];

    [actionSheetPicker addCustomButtonWithTitle:@"Today" value:[NSDate date]];
    actionSheetPicker.hideCancel = YES;
    [actionSheetPicker showActionSheetPicker];

impossible to run in xcode 6

Hi guys, thank for your project. Now I am facing a problem, I still want to be able to support ios 6 and xcode 5 helps me to test apps in ios 6 simulator. Unfortunately, your last changes cause compilation error in xcode 5.
in AbstractActionSheetPicker.m
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { - xcode 5 has no NSFoundationVersionNumber_iOS_7_1.
Can you redesign the comparison? Am able to do it by myself in my code, but everytime I run pod install, the code gets overwritten

Landscape broken in iOS 7

In the new update to support iOS 8 compatibility ActionSheetPicker doesn't work correctly (it's basically unusable) in landscape in iOS7 (I haven't checked iOS 6).

screen shot 2014-08-12 at 5 37 37 pm

DatePicker upper limit

How can we set a date range or rather a upper limit of date available in ActionSheetDatePicker ?

Like I am using it in date of birth field and right now it doesnt have any upper limit and shows future dates as well, what I want however is it to show maximum till today's date

Question: including ActionSheetPicker in a project

This is not an issue, but a question.

What is the preferred way to include ActionSheetPicker in a project? I've tried to include the CoreActionSheetPicker framework in my project but ld fails with the following error when I try to compile for the simulator:

ld: warning: ignoring file /Users/mts/Development/Projects/AmortizationV2/CoreActionSheetPicker.framework/CoreActionSheetPicker, missing required architecture x86_64 in file /Users/mts/Development/Projects/AmortizationV2/CoreActionSheetPicker.framework/CoreActionSheetPicker (3 slices)

I tried building CoreActionSheetPicker framework with different architecture settings without success.
Any tips?

Thanks,
Martin

Change tint color / font color of Done / Cancel buttons

I'd like to change the font color of the text on the picker "Cancel" and "Done" buttons. How can they be changed directly.

My application typically has black menus with white text on the menu.

I'm calling the following:

[ActionSheetStringPicker showPickerWithTitle:@"A-Trapezoidal (A-Trap)" rows:self.atrapNamesArray initialSelection:0 target:self successAction:@selector(atrapWasSelected:element:) cancelAction:@selector(actionPickerCancelled:) origin:self.view];

I do have a workaround by calling this line of code, but it causes havoc elsewhere inside my app. i end up putting this in multiple locations and switching the UIColor to do it.

UIBarButtonItem *barButtonAppearance = [UIBarButtonItem appearance];
[barButtonAppearance setTintColor:[UIColor blackColor]];

I'd be fine with changing the background color as an alternative.

How to change font of picker data rows?

I have seen plenty of examples in your sample project detailing how to customize buttons over the picker but there aren't any examples showing how to change the font of the data row in the action sheet. Any help is highly appreciated.

Thanks,
Jack.

Select a row

Hi,

I've been looking around and I did some tests it doesn't seems possible to me that we can use selectRow(row: Int, inComponent component: Int, animated: Bool) like for the default UIPickerView.

Can you add a method to do so please?

ActionSheetDatePicker target-action

I'm having a hard time getting a custom cancel button and target-action to work with a datePicker. I just added setCancelButton to the example project below:

ActionSheetDatePicker *datePicker = [[ActionSheetDatePicker alloc] initWithTitle:@"Select a time" datePickerMode:UIDatePickerModeTime selectedDate:self.selectedTime target:self action:@selector(timeWasSelected:element:) origin:sender];

[datePicker setCancelButton:[[UIBarButtonItem alloc] initWithTitle:@"Not sure"  style:UIBarButtonItemStylePlain target:self action:@selector(datePickerCancelled:) ]];

datePicker.minuteInterval = minuteInterval;

[datePicker showActionSheetPicker];

iOS8 - iPad popover, wrong size

It seems like iOS8 need a preferredSize for the content view controller of the popover, otherwise it will look like the one in the attachment.

I've fixed this issue in my fork by adding viewController.preferredContentSize = CGSizeMake(320, 260); in - (void)configureAndPresentPopoverForView:(UIView *)aView

ios simulator screen shot aug 26 2014 9 52 59 am

Pop over direction

It would be great if this library allows the control of which location the popup will appear relative to the origin. Right now the permittedarrowdirections is set to Any.

Invalid context warning in landscape

When launching an ActionSheetPicker in landscape mode I get a "invalid context warning" in the console. Aside from the warning it seems to work OK.

The error reads something like the following

Jul 30 11:29:49 .... ActionSheetPicker[5133] : CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

I can get rid of the error by modifying the configureAndPresentActionSheetForView: method in AbstractActionSheetPicker.m to pass in an empty string instead of nil when creating the actionSheet

https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/Pickers/AbstractActionSheetPicker.m#L424

From

_actionSheet = [[UIActionSheet alloc] initWithTitle:paddedSheetTitle delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];

To

_actionSheet = [[UIActionSheet alloc] initWithTitle:paddedSheetTitle delegate:nil cancelButtonTitle:@"" destructiveButtonTitle:nil otherButtonTitles:nil];

However while the context error goes away the picker isn't displayed correctly.

screen shot 2014-07-30 at 11 40 33 am

The error only seems to be on iOS 7. You can test this by running the example project and switching to landscape mode.

Example fails when clicking "Modal Test": 'Pushing a navigation controller is not supported'

I cloned a fresh version of the repo (October 8, 2014), made no changes and ran the ActionSheetPicker example. I get the following crash if I click the "Modal Test" button:

2014-10-08 17:45:15.042 ActionSheetPicker[8950:1362181] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010be5d3f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010a8b5bb7 objc_exception_throw + 45
    2   UIKit                               0x000000010929b617 __71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke + 0
    3   UIKit                               0x000000010929aca1 -[UINavigationController pushViewController:animated:] + 571
    4   UIKit                               0x00000001091469ee -[UIApplication sendAction:to:from:forEvent:] + 75
    5   UIKit                               0x000000010924cbd0 -[UIControl _sendActionsForEvents:withEvent:] + 467
    6   UIKit                               0x000000010924bf9f -[UIControl touchesEnded:withEvent:] + 522
    7   UIKit                               0x00000001094f0c30 _UIGestureRecognizerUpdate + 9487
    8   UIKit                               0x000000010918c0a6 -[UIWindow _sendGesturesForEvent:] + 1041
    9   UIKit                               0x000000010918ccd3 -[UIWindow sendEvent:] + 667
    10  UIKit                               0x0000000109159ae1 -[UIApplication sendEvent:] + 246
    11  UIKit                               0x0000000109166bad _UIApplicationHandleEventFromQueueEvent + 17370
    12  UIKit                               0x0000000109142233 _UIApplicationHandleEventQueue + 1961
    13  CoreFoundation                      0x000000010bd92ad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    14  CoreFoundation                      0x000000010bd8899d __CFRunLoopDoSources0 + 269
    15  CoreFoundation                      0x000000010bd87fd4 __CFRunLoopRun + 868
    16  CoreFoundation                      0x000000010bd87a06 CFRunLoopRunSpecific + 470
    17  GraphicsServices                    0x000000010bab89f0 GSEventRunModal + 161
    18  UIKit                               0x0000000109145550 UIApplicationMain + 1282
    19  ActionSheetPicker                   0x0000000109097a23 main + 115
    20  libdyld.dylib                       0x000000010fc9d145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I've never used storyboards (in my apps I manage the transitions in code). Any ideas what I should do to make fix the example?

NavigationController

Whenever the done completion block runs, the VC pops back to the initial VC. I am sure this is not related to my code as i tested it. I will try to give it a look. Can you check this too, please ?

Thank you,
Sebastian

configurePickerView for ActionSheetCustomPicker throws exception

I think you want:

if (self.initialSelections.count > 0)

instead of:

if (self.initialSelections)

or only initialize the array in the initWithTitle method if intialSelections is not nill:

    if(initialSelections != nil)
    {
       self.initialSelections = [[NSArray alloc] initWithArray:initialSelections];
    }

Great stuff; measurement doesn't work well with imperial units

Thanks for saving me so much time. This is great work.

The measurement picker doesn't work well with imperial units. I am using this for a health application and users can choose their height. Unfortunately they end up with three columns in the picker: feet, first digit of inches, and second digit of inches. The first digit of inches is either a 0 or a 1.

Ideally, there would be a boolean for separating digits, or don't separate digits if the range is less than 30 or something.

Open and chose lag?

Hello
Anybody else experience lag when the ActionSheetPicker opens and closes? I'm using it on IOS 7.1

Add delegate for custom button pressed

Feature request, please add a delegate that is called on a custom button being clicked.
The delegate can be called with or without the need to value in the picker.

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.