48 lines
1.3 KiB
Objective-C
48 lines
1.3 KiB
Objective-C
//
|
|
// DateSignModel.m
|
|
// CustomPicker
|
|
//
|
|
// Created by ko1o on 2018/7/25.
|
|
// Copyright © 2018年 ko1o. All rights reserved.
|
|
//
|
|
|
|
#import "FSDateSignModel.h"
|
|
|
|
@implementation FSDateSignModel
|
|
|
|
+ (FSDateSignModel *)sharedInstance
|
|
{
|
|
static FSDateSignModel *_dateSignModel = nil;
|
|
static dispatch_once_t onceToken;
|
|
dispatch_once(&onceToken, ^{
|
|
_dateSignModel = [[FSDateSignModel alloc] init];
|
|
});
|
|
return _dateSignModel;
|
|
}
|
|
|
|
- (NSString *)getDateSignWithMonth:(int)month day:(int)day
|
|
{
|
|
NSString *dateSignString = @"魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
|
|
NSString *dateSignFormat = @"102123444543";
|
|
|
|
if (month<1||month>12||day<1||day>31){
|
|
return @"错误日期格式!";
|
|
}
|
|
|
|
if(month==2 && day>29)
|
|
{
|
|
return @"错误日期格式!!";
|
|
}else if(month==4 || month==6 || month==9 || month==11) {
|
|
|
|
if (day>30) {
|
|
return @"错误日期格式!!!";
|
|
}
|
|
}
|
|
|
|
NSString *result = [NSString stringWithFormat:@"%@",[dateSignString substringWithRange:NSMakeRange(month*2-(day < [[dateSignFormat substringWithRange:NSMakeRange((month-1), 1)] intValue] - (-19))*2,2)]];
|
|
result = [NSString stringWithFormat:@"%@座",result];
|
|
return result;
|
|
}
|
|
|
|
@end
|