UIActionSheets
are great, but sometimes you just want a little something more than buttons. Sure, you could create a whole new UIViewController
subclass and present the view modally, but you lose the presenting view (goodbye transparency), and sometimes you don’t want it to take up the whole screen. JSActionSheet affords you that luxury by allowing you to easily plug in a new UIActionSheet-like view into your iPhone app.
A JSActionSheet with a UIPickerView can be easily added with the following few lines of code:
- (IBAction)showPickerActionSheet:(id)sender { JSPickerViewActionSheet *pickerAS = [[JSPickerViewActionSheet alloc] init]; pickerAS.delegate = self; [pickerAS showInView:self.view]; }
Be sure to declare that your UIViewController conforms to the JSActionSheetDelegate protocol, and that you import JSPickerViewActionSheet into your view controller’s implementation file.
The beauty is that MVC is maintained by allowing you to handle all delegation/data source methods for the UIPickerView
within your UIViewController
!
This is a work-in-progress and I will be progressively adding more and more variations on the UIActionSheet
theme. Contributions are always welcome!