ActionSheetDatePicker 2.h 5.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. //Copyright (c) 2011, Tim Cinel
  3. //All rights reserved.
  4. //
  5. //Redistribution and use in source and binary forms, with or without
  6. //modification, are permitted provided that the following conditions are met:
  7. //* Redistributions of source code must retain the above copyright
  8. //notice, this list of conditions and the following disclaimer.
  9. //* Redistributions in binary form must reproduce the above copyright
  10. //notice, this list of conditions and the following disclaimer in the
  11. //documentation and/or other materials provided with the distribution.
  12. //* Neither the name of the <organization> nor the
  13. //names of its contributors may be used to endorse or promote products
  14. //derived from this software without specific prior written permission.
  15. //
  16. //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  17. //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. //DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  20. //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. //
  27. #import "AbstractActionSheetPicker.h"
  28. @class ActionSheetDatePicker;
  29. typedef void(^ActionDateDoneBlock)(ActionSheetDatePicker *picker, id selectedDate, id origin); //selectedDate is NSDate or NSNumber for "UIDatePickerModeCountDownTimer"
  30. typedef void(^ActionDateCancelBlock)(ActionSheetDatePicker *picker);
  31. @interface ActionSheetDatePicker : AbstractActionSheetPicker
  32. @property (nonatomic, retain) NSDate *minimumDate; // specify min/max date range. default is nil. When min > max, the values are ignored. Ignored in countdown timer mode
  33. @property (nonatomic, retain) NSDate *maximumDate; // default is nil
  34. @property (nonatomic) NSInteger minuteInterval; // display minutes wheel with interval. interval must be evenly divided into 60. default is 1. min is 1, max is 30
  35. @property (nonatomic, retain) NSLocale *locale; // default is [NSLocale currentLocale]. setting nil returns to default
  36. @property (nonatomic, copy) NSCalendar *calendar; // default is [NSCalendar currentCalendar]. setting nil returns to default
  37. @property (nonatomic, retain) NSTimeZone *timeZone; // default is nil. use current time zone or time zone from calendar
  38. @property (nonatomic, assign) NSTimeInterval countDownDuration; // for UIDatePickerModeCountDownTimer, ignored otherwise. default is 0.0. limit is 23:59 (86,399 seconds). value being set is div 60 (drops remaining seconds).
  39. @property (nonatomic, copy) ActionDateDoneBlock onActionSheetDone;
  40. @property (nonatomic, copy) ActionDateCancelBlock onActionSheetCancel;
  41. + (instancetype)showPickerWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate target:(id)target action:(SEL)action origin:(id)origin;
  42. + (instancetype)showPickerWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate target:(id)target action:(SEL)action origin:(id)origin cancelAction:(SEL)cancelAction;
  43. + (instancetype)showPickerWithTitle:(NSString *)title
  44. datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate
  45. minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate
  46. target:(id)target action:(SEL)action origin:(id)origin;
  47. + (instancetype)showPickerWithTitle:(NSString *)title
  48. datePickerMode:(UIDatePickerMode)datePickerMode
  49. selectedDate:(NSDate *)selectedDate
  50. doneBlock:(ActionDateDoneBlock)doneBlock
  51. cancelBlock:(ActionDateCancelBlock)cancelBlock
  52. origin:(UIView*)view;
  53. + (instancetype)showPickerWithTitle:(NSString *)title
  54. datePickerMode:(UIDatePickerMode)datePickerMode
  55. selectedDate:(NSDate *)selectedDate
  56. minimumDate:(NSDate *)minimumDate
  57. maximumDate:(NSDate *)maximumDate
  58. doneBlock:(ActionDateDoneBlock)doneBlock
  59. cancelBlock:(ActionDateCancelBlock)cancelBlock
  60. origin:(UIView*)view;
  61. - (id)initWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate target:(id)target action:(SEL)action origin:(id)origin;
  62. - (instancetype)initWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate target:(id)target action:(SEL)action origin:(id)origin;
  63. - (instancetype)initWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate target:(id)target action:(SEL)action origin:(id)origin cancelAction:(SEL)cancelAction;
  64. - (instancetype)initWithTitle:(NSString *)title datePickerMode:(UIDatePickerMode)datePickerMode selectedDate:(NSDate *)selectedDate minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate target:(id)target action:(SEL)action cancelAction:(SEL)cancelAction origin:(id)origin;
  65. - (instancetype)initWithTitle:(NSString *)title
  66. datePickerMode:(UIDatePickerMode)datePickerMode
  67. selectedDate:(NSDate *)selectedDate
  68. doneBlock:(ActionDateDoneBlock)doneBlock
  69. cancelBlock:(ActionDateCancelBlock)cancelBlock
  70. origin:(UIView*)view;
  71. - (void)eventForDatePicker:(id)sender;
  72. @end