Commit fe09f1ce cgx

完成用户生日修改

1 个父辈 82b6fc5a
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
D01814EB28002A8200583D4E /* DsMiddleView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814EA28002A8200583D4E /* DsMiddleView.m */; }; D01814EB28002A8200583D4E /* DsMiddleView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814EA28002A8200583D4E /* DsMiddleView.m */; };
D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814ED28002DC700583D4E /* HeaderDataModel.m */; }; D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D01814ED28002DC700583D4E /* HeaderDataModel.m */; };
D01C9D6728167F9D00163567 /* InfoModifyAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01C9D6628167F9D00163567 /* InfoModifyAlertView.m */; }; D01C9D6728167F9D00163567 /* InfoModifyAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01C9D6628167F9D00163567 /* InfoModifyAlertView.m */; };
D01C9D6E28168BFC00163567 /* WSDatePickerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D01C9D6B28168BFC00163567 /* WSDatePickerView.xib */; };
D01C9D6F28168BFC00163567 /* WSDatePickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D01C9D6C28168BFC00163567 /* WSDatePickerView.m */; };
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = D01C9D6D28168BFC00163567 /* NSDate+Extension.m */; };
D020CE1F280D951400E7E82F /* invite_friend.webp in Resources */ = {isa = PBXBuildFile; fileRef = D020CE1E280D915D00E7E82F /* invite_friend.webp */; }; D020CE1F280D951400E7E82F /* invite_friend.webp in Resources */ = {isa = PBXBuildFile; fileRef = D020CE1E280D915D00E7E82F /* invite_friend.webp */; };
D027EE2627FB3DC0004BBA61 /* NetLoadingStateView.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2527FB3DC0004BBA61 /* NetLoadingStateView.m */; }; D027EE2627FB3DC0004BBA61 /* NetLoadingStateView.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2527FB3DC0004BBA61 /* NetLoadingStateView.m */; };
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2827FB51D0004BBA61 /* DSGifHeader.m */; }; D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D027EE2827FB51D0004BBA61 /* DSGifHeader.m */; };
...@@ -143,6 +146,11 @@ ...@@ -143,6 +146,11 @@
D01814ED28002DC700583D4E /* HeaderDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HeaderDataModel.m; sourceTree = "<group>"; }; D01814ED28002DC700583D4E /* HeaderDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HeaderDataModel.m; sourceTree = "<group>"; };
D01C9D6528167F9D00163567 /* InfoModifyAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoModifyAlertView.h; sourceTree = "<group>"; }; D01C9D6528167F9D00163567 /* InfoModifyAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoModifyAlertView.h; sourceTree = "<group>"; };
D01C9D6628167F9D00163567 /* InfoModifyAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoModifyAlertView.m; sourceTree = "<group>"; }; D01C9D6628167F9D00163567 /* InfoModifyAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoModifyAlertView.m; sourceTree = "<group>"; };
D01C9D6928168BFC00163567 /* NSDate+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Extension.h"; sourceTree = "<group>"; };
D01C9D6A28168BFC00163567 /* WSDatePickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSDatePickerView.h; sourceTree = "<group>"; };
D01C9D6B28168BFC00163567 /* WSDatePickerView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WSDatePickerView.xib; sourceTree = "<group>"; };
D01C9D6C28168BFC00163567 /* WSDatePickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSDatePickerView.m; sourceTree = "<group>"; };
D01C9D6D28168BFC00163567 /* NSDate+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+Extension.m"; sourceTree = "<group>"; };
D020CE1E280D915D00E7E82F /* invite_friend.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = invite_friend.webp; sourceTree = "<group>"; }; D020CE1E280D915D00E7E82F /* invite_friend.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = invite_friend.webp; sourceTree = "<group>"; };
D027EE2427FB3DC0004BBA61 /* NetLoadingStateView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetLoadingStateView.h; sourceTree = "<group>"; }; D027EE2427FB3DC0004BBA61 /* NetLoadingStateView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetLoadingStateView.h; sourceTree = "<group>"; };
D027EE2527FB3DC0004BBA61 /* NetLoadingStateView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NetLoadingStateView.m; sourceTree = "<group>"; }; D027EE2527FB3DC0004BBA61 /* NetLoadingStateView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NetLoadingStateView.m; sourceTree = "<group>"; };
...@@ -390,6 +398,18 @@ ...@@ -390,6 +398,18 @@
path = DataSource; path = DataSource;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D01C9D6828168BFC00163567 /* WSDaePickerView */ = {
isa = PBXGroup;
children = (
D01C9D6928168BFC00163567 /* NSDate+Extension.h */,
D01C9D6A28168BFC00163567 /* WSDatePickerView.h */,
D01C9D6B28168BFC00163567 /* WSDatePickerView.xib */,
D01C9D6C28168BFC00163567 /* WSDatePickerView.m */,
D01C9D6D28168BFC00163567 /* NSDate+Extension.m */,
);
path = WSDaePickerView;
sourceTree = "<group>";
};
D027EE2327FB3C99004BBA61 /* Network */ = { D027EE2327FB3C99004BBA61 /* Network */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -813,10 +833,11 @@ ...@@ -813,10 +833,11 @@
D0E9408127FE961300D57495 /* Vendors */ = { D0E9408127FE961300D57495 /* Vendors */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D07DAC912810557D0067A1BF /* RSKImageCropper */,
D046FDF528100342000295AC /* UMSocial_6.10.4 */,
D01814D927FFD91100583D4E /* DataSource */, D01814D927FFD91100583D4E /* DataSource */,
D01814CA27FFCBAF00583D4E /* CWCarousel */, D01814CA27FFCBAF00583D4E /* CWCarousel */,
D046FDF528100342000295AC /* UMSocial_6.10.4 */,
D01C9D6828168BFC00163567 /* WSDaePickerView */,
D07DAC912810557D0067A1BF /* RSKImageCropper */,
D0E65FF32807A654006562F2 /* HYBUnicodeReadable */, D0E65FF32807A654006562F2 /* HYBUnicodeReadable */,
D0878F49280BEFF9005F1B7F /* YBAttributeTextTapAction */, D0878F49280BEFF9005F1B7F /* YBAttributeTextTapAction */,
); );
...@@ -972,6 +993,7 @@ ...@@ -972,6 +993,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D0C09ED728007D9100709D4C /* relax_normal_lottie.json in Resources */, D0C09ED728007D9100709D4C /* relax_normal_lottie.json in Resources */,
D01C9D6E28168BFC00163567 /* WSDatePickerView.xib in Resources */,
D0C09ED828007D9100709D4C /* 478_lottie.json in Resources */, D0C09ED828007D9100709D4C /* 478_lottie.json in Resources */,
D046FE0D28100342000295AC /* UMSocialSDKResources.bundle in Resources */, D046FE0D28100342000295AC /* UMSocialSDKResources.bundle in Resources */,
D04B3DB327F6F6070022F8DF /* Home.storyboard in Resources */, D04B3DB327F6F6070022F8DF /* Home.storyboard in Resources */,
...@@ -1053,6 +1075,7 @@ ...@@ -1053,6 +1075,7 @@
D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */, D0E65FFB2807A654006562F2 /* NSDictionary+HYBUnicodeReadable.m in Sources */,
D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */, D0E65FFA2807A654006562F2 /* NSArray+HYBUnicodeReadable.m in Sources */,
D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */, D04B3DC027F6F82D0022F8DF /* ProfileController.m in Sources */,
D01C9D7028168BFC00163567 /* NSDate+Extension.m in Sources */,
D0C50B3027FD1BEB00DC68F0 /* PrivacyView.m in Sources */, D0C50B3027FD1BEB00DC68F0 /* PrivacyView.m in Sources */,
D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */, D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */,
D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */, D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */,
...@@ -1123,6 +1146,7 @@ ...@@ -1123,6 +1146,7 @@
D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */, D027EE3027FB52DA004BBA61 /* UIImage+Extras.m in Sources */,
D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */, D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */,
D04B3DC327F6F9390022F8DF /* HomeViewController.m in Sources */, D04B3DC327F6F9390022F8DF /* HomeViewController.m in Sources */,
D01C9D6F28168BFC00163567 /* WSDatePickerView.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1312,7 +1336,7 @@ ...@@ -1312,7 +1336,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
); );
MARKETING_VERSION = 1.1.1; MARKETING_VERSION = 1.1.2;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
...@@ -1353,7 +1377,7 @@ ...@@ -1353,7 +1377,7 @@
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**"; HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist; INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠"; INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev";
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。"; INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
...@@ -1373,7 +1397,7 @@ ...@@ -1373,7 +1397,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
); );
MARKETING_VERSION = 1.1.1; MARKETING_VERSION = 1.1.2;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
...@@ -1474,7 +1498,7 @@ ...@@ -1474,7 +1498,7 @@
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**"; HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist; INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Beta"; INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev";
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。"; INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
...@@ -1494,7 +1518,7 @@ ...@@ -1494,7 +1518,7 @@
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/WeChat/WechatSDK",
"$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ", "$(PROJECT_DIR)/DreamSleep/Vendors/UMSocial_6.10.4/SocialLibraries/QQ",
); );
MARKETING_VERSION = 1.1.1; MARKETING_VERSION = 1.1.2;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "UserInfoTableView.h" #import "UserInfoTableView.h"
#import "NickNameController.h" #import "NickNameController.h"
#import "InfoModifyAlertView.h" #import "InfoModifyAlertView.h"
#import "WSDatePickerView.h"
/// 自定义用户信息显示数据model /// 自定义用户信息显示数据model
@interface UserShowModel : NSObject @interface UserShowModel : NSObject
...@@ -138,15 +139,39 @@ ...@@ -138,15 +139,39 @@
InfoModifyAlertView *genderView = [[InfoModifyAlertView alloc] initWithDelegate:self type:AlertTypeGender]; InfoModifyAlertView *genderView = [[InfoModifyAlertView alloc] initWithDelegate:self type:AlertTypeGender];
[genderView showInfoModifyAlertView]; [genderView showInfoModifyAlertView];
} else if (indexPath.row == 2) { // 修改生日 } else if (indexPath.row == 2) { // 修改生日
WS(weakSelf);
NSDate *birthDate = [NSDate date:[LoginUtils getBirthday] WithFormat:@"yyyy-MM-dd"];
NSDate *defaultDate = [NSDate date:@"1975-07-15" WithFormat:@"yyyy-MM-dd"];
NSDate *scrollDate = birthDate ? birthDate : defaultDate;
WSDatePickerView *datepicker = [[WSDatePickerView alloc] initWithDateStyle:DateStyleShowYearMonthDay scrollToDate:scrollDate CompleteBlock:^(NSDate *selectDate) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *selectDateStr = [dateFormatter stringFromDate:selectDate];
NSDictionary *data = @{@"birthday" : selectDateStr};
[DSProgressHUD showProgressHUDWithInfo:@""];
[UserRequestModel updateUserInfoWithData:data completion:^(UserRequestModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) {
[DSProgressHUD showToast:@"修改成功"];
[LoginUtils updateUserInfo:data];
[weakSelf.infoDataSource addDataArray:[UserShowModel getUserShowDatas]];
[weakSelf reloadData];
}
}];
}];
[datepicker setMinLimitDate:[NSDate date:@"1930-01-01" WithFormat:@"yyyy-MM-dd"]];
[datepicker setMaxLimitDate:[NSDate date]];
[datepicker show];
} }
} }
#pragma mark - InfoModifyAlertViewDelegate #pragma mark - InfoModifyAlertViewDelegate && 修改性别请求
- (void)didSelectWithType:(AlertType)type index:(int)index { - (void)didSelectWithType:(AlertType)type index:(int)index {
[DSProgressHUD showProgressHUDWithInfo:@""];
NSDictionary *data = @{@"gender" : @(index == 1 ? 1 : 0)};
WS(weakSelf); WS(weakSelf);
NSDictionary *data = @{@"gender" : @(index == 1 ? 1 : 0)};
[DSProgressHUD showProgressHUDWithInfo:@""];
[UserRequestModel updateUserInfoWithData:data completion:^(UserRequestModel * _Nonnull requestModel) { [UserRequestModel updateUserInfoWithData:data completion:^(UserRequestModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD]; [DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) { if (requestModel.resCode == DSResCodeSuccess) {
......
...@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 获取用户头像 /// 获取用户头像
+ (NSString *)getFaceImg; + (NSString *)getFaceImg;
/// 获取用户生日
+ (NSString *)getBirthday;
/// 更新sid和token /// 更新sid和token
/// @param sid sid /// @param sid sid
/// @param token token /// @param token token
......
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
return userModel.face_img; return userModel.face_img;
} }
+ (NSString *)getBirthday {
UserModel *userModel = [self getUserLoginData];
return userModel.birthday;
}
+ (void)updateSid:(NSString *)sid token:(NSString *)token { + (void)updateSid:(NSString *)sid token:(NSString *)token {
UserModel *userModel = [self getUserLoginData]; UserModel *userModel = [self getUserLoginData];
userModel.sid = sid; userModel.sid = sid;
......
//
// NSDate+Extension.h
// SmartLock
//
// Created by 江欣华 on 2016/10/25.
// Copyright © 2016年 工程锁. All rights reserved.
//
#import <Foundation/Foundation.h>
#define D_MINUTE 60
#define D_HOUR 3600
#define D_DAY 86400
#define D_WEEK 604800
#define D_YEAR 31556926
@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
//
// WSDatePickerView.h
// WSDatePicker
//
// Created by iMac on 17/2/23.
// Copyright © 2017年 zws. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NSDate+Extension.h"
/**
* 弹出日期类型
*/
typedef enum {
DateStyleShowYearMonthDayHourMinute = 0, // 年月日时分
DateStyleShowMonthDayHourMinute, // 月日时分
DateStyleShowYearMonthDay, // 年月日
DateStyleShowMonthDay, // 月日
DateStyleShowHourMinute // 时分
} WSDateStyle;
@interface WSDatePickerView : UIView
/**
* 滚轮日期颜色(默认黑色)
*/
@property (nonatomic,strong) UIColor *datePickerColor;
/**
* 选中日期颜色
*/
@property (nonatomic,strong) UIColor *selectedPickerColor;
/**
* 选中分割线颜色
*/
@property (nonatomic,strong) UIColor *selectedLineColor;
/**
* 限制最小时间(默认0) datePicker小于最小日期则滚动回最小限制日期
*/
@property (nonatomic, retain) NSDate *minLimitDate;
/**
* 限制最大时间(默认2099)datePicker大于最大日期则滚动回最大限制日期
*/
@property (nonatomic, retain) NSDate *maxLimitDate;
/**
默认滚动到当前时间
*/
- (instancetype)initWithDateStyle:(WSDateStyle)datePickerStyle CompleteBlock:(void(^)(NSDate *))completeBlock;
/**
滚动到指定的的日期
*/
- (instancetype)initWithDateStyle:(WSDateStyle)datePickerStyle scrollToDate:(NSDate *)scrollToDate CompleteBlock:(void(^)(NSDate *))completeBlock;
/**
显示
*/
- (void)show;
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="WSDatePickerView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gvZ-fK-lMh">
<rect key="frame" x="0.0" y="221" width="375" height="225"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.99997437000274658" blue="0.99999129772186279" alpha="0.9847876320422535" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.40105064655172412" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="buttomView" destination="gvZ-fK-lMh" id="1kp-xm-4pD"/>
</connections>
<point key="canvasLocation" x="-41" y="51"/>
</view>
</objects>
</document>
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!