ActionSheetMultipleStringPicker.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // ActionSheetMultipleStringPicker.h
  3. // CoreActionSheetPicker
  4. //
  5. // Created by Alejandro on 21/07/15.
  6. // Copyright (c) 2015 Petr Korolev. All rights reserved.
  7. //
  8. //Redistribution and use in source and binary forms, with or without
  9. //modification, are permitted provided that the following conditions are met:
  10. //* Redistributions of source code must retain the above copyright
  11. //notice, this list of conditions and the following disclaimer.
  12. //* Redistributions in binary form must reproduce the above copyright
  13. //notice, this list of conditions and the following disclaimer in the
  14. //documentation and/or other materials provided with the distribution.
  15. //* Neither the name of the <organization> nor the
  16. //names of its contributors may be used to endorse or promote products
  17. //derived from this software without specific prior written permission.
  18. //
  19. //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. //DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  23. //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. //åLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. //
  30. #import "AbstractActionSheetPicker.h"
  31. @class ActionSheetMultipleStringPicker;
  32. typedef void(^ActionMultipleStringDoneBlock)(ActionSheetMultipleStringPicker *picker, NSArray *selectedIndexes, id selectedValues);
  33. typedef void(^ActionMultipleStringCancelBlock)(ActionSheetMultipleStringPicker *picker);
  34. @interface ActionSheetMultipleStringPicker : AbstractActionSheetPicker <UIPickerViewDelegate, UIPickerViewDataSource>
  35. /**
  36. * Create and display an action sheet picker.
  37. *
  38. * @param title Title label for picker
  39. * @param data is an array of strings to use for the picker's available selection choices
  40. * @param indexes is used to establish the initially selected row;
  41. * @param target must not be empty. It should respond to "onSuccess" actions.
  42. * @param successAction successAction
  43. * @param cancelActionOrNil cancelAction
  44. * @param origin must not be empty. It can be either an originating container view or a UIBarButtonItem to use with a popover arrow.
  45. *
  46. * @return return instance of picker
  47. */
  48. + (instancetype)showPickerWithTitle:(NSString *)title rows:(NSArray *)data initialSelection:(NSArray *)indexes target:(id)target successAction:(SEL)successAction cancelAction:(SEL)cancelActionOrNil origin:(id)origin;
  49. // Create an action sheet picker, but don't display until a subsequent call to "showActionPicker". Receiver must release the picker when ready. */
  50. - (instancetype)initWithTitle:(NSString *)title rows:(NSArray *)data initialSelection:(NSArray *)indexes target:(id)target successAction:(SEL)successAction cancelAction:(SEL)cancelActionOrNil origin:(id)origin;
  51. + (instancetype)showPickerWithTitle:(NSString *)title rows:(NSArray *)strings initialSelection:(NSArray *)indexes doneBlock:(ActionMultipleStringDoneBlock)doneBlock cancelBlock:(ActionMultipleStringCancelBlock)cancelBlock origin:(id)origin;
  52. - (instancetype)initWithTitle:(NSString *)title rows:(NSArray *)strings initialSelection:(NSArray *)indexes doneBlock:(ActionMultipleStringDoneBlock)doneBlock cancelBlock:(ActionMultipleStringCancelBlock)cancelBlockOrNil origin:(id)origin;
  53. @property (nonatomic, copy) ActionMultipleStringDoneBlock onActionSheetDone;
  54. @property (nonatomic, copy) ActionMultipleStringCancelBlock onActionSheetCancel;
  55. @end