| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- //
- // CCDatePickerView.h
- // ChooseTimePickerView
- //
- // Created by 陈红 on 2017/3/12.
- // Copyright © 2017年 陈红:ch_email@126.cm. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #define D_MINUTE 60
- #define D_HOUR 3600
- #define D_DAY 86400
- #define D_WEEK 604800
- #define D_YEAR 31556926
- typedef void(^dateBlock)(NSDate *dateString);
- @interface CCDatePickerView : UIView<UIPickerViewDelegate,UIPickerViewDataSource>
- @property (nonatomic,strong)UIPickerView *datePicker;
- /**
- 时间选择按钮
- */
- @property(nonatomic,strong)UIButton *cancelButton;
- @property(nonatomic,strong)UIButton *okButton;
- /**
- NSDate回调
- */
- @property (nonatomic,copy)dateBlock blcok;
- /**
- 时间的标题
- */
- @property(nonatomic,strong)UILabel *chooseTimeLabel;
- /**
- 控件出现
- */
- - (void)fadeIn;
- /**
- 控件显示
- */
- - (void)fadeOut;
- @end
- @interface NSDate (Extension)
- + (NSCalendar *) currentCalendar; // avoid bottlenecks
- // Relative dates from the current date
- + (NSDate *) dateTomorrow;
- + (NSDate *) dateYesterday;
- + (NSDate *) dateWithDaysFromNow: (NSInteger) days;
- + (NSDate *) dateWithDaysBeforeNow: (NSInteger) days;
- + (NSDate *) dateWithHoursFromNow: (NSInteger) dHours;
- + (NSDate *) dateWithHoursBeforeNow: (NSInteger) dHours;
- + (NSDate *) dateWithMinutesFromNow: (NSInteger) dMinutes;
- + (NSDate *) dateWithMinutesBeforeNow: (NSInteger) dMinutes;
- + (NSDate *)date:(NSString *)datestr WithFormat:(NSString *)format;
- // Short string utilities
- - (NSString *) stringWithDateStyle: (NSDateFormatterStyle) dateStyle timeStyle: (NSDateFormatterStyle) timeStyle;
- - (NSString *) stringWithFormat: (NSString *) format;
- @property (nonatomic, readonly) NSString *shortString;
- @property (nonatomic, readonly) NSString *shortDateString;
- @property (nonatomic, readonly) NSString *shortTimeString;
- @property (nonatomic, readonly) NSString *mediumString;
- @property (nonatomic, readonly) NSString *mediumDateString;
- @property (nonatomic, readonly) NSString *mediumTimeString;
- @property (nonatomic, readonly) NSString *longString;
- @property (nonatomic, readonly) NSString *longDateString;
- @property (nonatomic, readonly) NSString *longTimeString;
- // Comparing dates
- - (BOOL) isEqualToDateIgnoringTime: (NSDate *) aDate;
- - (BOOL) isToday;
- - (BOOL) isTomorrow;
- - (BOOL) isYesterday;
- - (BOOL) isSameWeekAsDate: (NSDate *) aDate;
- - (BOOL) isThisWeek;
- - (BOOL) isNextWeek;
- - (BOOL) isLastWeek;
- - (BOOL) isSameMonthAsDate: (NSDate *) aDate;
- - (BOOL) isThisMonth;
- - (BOOL) isNextMonth;
- - (BOOL) isLastMonth;
- - (BOOL) isSameYearAsDate: (NSDate *) aDate;
- - (BOOL) isThisYear;
- - (BOOL) isNextYear;
- - (BOOL) isLastYear;
- - (BOOL) isEarlierThanDate: (NSDate *) aDate;
- - (BOOL) isLaterThanDate: (NSDate *) aDate;
- - (BOOL) isInFuture;
- - (BOOL) isInPast;
- // Date roles
- - (BOOL) isTypicallyWorkday;
- - (BOOL) isTypicallyWeekend;
- // Adjusting dates
- - (NSDate *) dateByAddingYears: (NSInteger) dYears;
- - (NSDate *) dateBySubtractingYears: (NSInteger) dYears;
- - (NSDate *) dateByAddingMonths: (NSInteger) dMonths;
- - (NSDate *) dateBySubtractingMonths: (NSInteger) dMonths;
- - (NSDate *) dateByAddingDays: (NSInteger) dDays;
- - (NSDate *) dateBySubtractingDays: (NSInteger) dDays;
- - (NSDate *) dateByAddingHours: (NSInteger) dHours;
- - (NSDate *) dateBySubtractingHours: (NSInteger) dHours;
- - (NSDate *) dateByAddingMinutes: (NSInteger) dMinutes;
- - (NSDate *) dateBySubtractingMinutes: (NSInteger) dMinutes;
- // Date extremes
- - (NSDate *) dateAtStartOfDay;
- - (NSDate *) dateAtEndOfDay;
- // Retrieving intervals
- - (NSInteger) minutesAfterDate: (NSDate *) aDate;
- - (NSInteger) minutesBeforeDate: (NSDate *) aDate;
- - (NSInteger) hoursAfterDate: (NSDate *) aDate;
- - (NSInteger) hoursBeforeDate: (NSDate *) aDate;
- - (NSInteger) daysAfterDate: (NSDate *) aDate;
- - (NSInteger) daysBeforeDate: (NSDate *) aDate;
- - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate;
- // Decomposing dates
- @property (readonly) NSInteger nearestHour;
- @property (readonly) NSInteger hour;
- @property (readonly) NSInteger minute;
- @property (readonly) NSInteger seconds;
- @property (readonly) NSInteger day;
- @property (readonly) NSInteger month;
- @property (readonly) NSInteger week;
- @property (readonly) NSInteger weekday;
- @property (readonly) NSInteger nthWeekday; // e.g. 2nd Tuesday of the month == 2
- @property (readonly) NSInteger year;
- - (NSDate *)dateWithYMD;
- - (NSDate *)dateWithFormatter:(NSString *)formatter;
- @end
- @interface UIView (Extension)
- /** 起点x坐标 */
- @property (nonatomic, assign) CGFloat x;
- /** 起点y坐标 */
- @property (nonatomic, assign) CGFloat y;
- /** 中心点x坐标 */
- @property (nonatomic, assign) CGFloat centerX;
- /** 中心点y坐标 */
- @property (nonatomic, assign) CGFloat centerY;
- /** 宽度 */
- @property (nonatomic, assign) CGFloat width;
- /** 高度 */
- @property (nonatomic, assign) CGFloat height;
- /** 顶部 */
- @property (nonatomic, assign) CGFloat top;
- /** 底部 */
- @property (nonatomic, assign) CGFloat bottom;
- /** 左边 */
- @property (nonatomic, assign) CGFloat left;
- /** 右边 */
- @property (nonatomic, assign) CGFloat right;
- /** size */
- @property (nonatomic, assign) CGSize size;
- /** origin */
- @property (nonatomic, assign) CGPoint origin;
- /** 设置圆角 */
- - (void)rounded:(CGFloat)cornerRadius;
- /** 设置圆角和边框 */
- - (void)rounded:(CGFloat)cornerRadius width:(CGFloat)borderWidth color:(UIColor *)borderColor;
- /** 设置边框 */
- - (void)border:(CGFloat)borderWidth color:(UIColor *)borderColor;
- /** 给哪几个角设置圆角 */
- -(void)round:(CGFloat)cornerRadius RectCorners:(UIRectCorner)rectCorner;
- /** 设置阴影 */
- -(void)shadow:(UIColor *)shadowColor opacity:(CGFloat)opacity radius:(CGFloat)radius offset:(CGSize)offset;
- - (UIViewController *)viewController;
- + (CGFloat)getLabelHeightByWidth:(CGFloat)width Title:(NSString *)title font:(UIFont *)font;
- @end
|