For an alternative that handles UIPickerView and action tables, checkout ActionSheetPicker
https://github.com/TimCinel/ActionSheetPicker
Cocoapods are included. It handles all cancel and end buttons in the Action Sheet. The examples from the project project are great. I choose an ActionSheetStringPicker that only handles String-based parameters easily, but the API can handle most of everything I can think of.
I initially started a solution similar to a security question, but came across this project and took about 20 minutes to integrate it into the application for use, including using cocopods: ActionSheetPicker (~> 0.0)
Hope this helps.
Download the git project and look at the following classes:
- ActionSheetPickerViewController.m
- ActionSheetPickerCustomPickerDelegate.h
Here is just about most of the code I added, plus the import * .h.
- (IBAction)gymTouched:(id)sender { NSLog(@"gym touched"); [ActionSheetStringPicker showPickerWithTitle:@"Select a Gym" rows:self.locations initialSelection:self.selectedIndex target:self successAction:@selector(gymWasSelected:element:) cancelAction:@selector(actionPickerCancelled:) origin:sender]; } - (void)actionPickerCancelled:(id)sender { NSLog(@"Delegate has been informed that ActionSheetPicker was cancelled"); } - (void)gymWasSelected:(NSNumber *)selectedIndex element:(id)element { self.selectedIndex = [selectedIndex intValue];
Nick N Apr 2 '14 at 4:51 on 2014-04-02 04:51
source share