Commit 1402b982 by 李威

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256CC21EC652E0025C7E5"
BuildableName = "MoreMeAI.app"
BlueprintName = "DKMoreMe"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256CC21EC652E0025C7E5"
BuildableName = "MoreMeAI.app"
BlueprintName = "DKMoreMe"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256E421EC65420025C7E5"
BuildableName = "MoreMeTests.xctest"
BlueprintName = "MoreMeTests"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256EF21EC65420025C7E5"
BuildableName = "MoreMeUITests.xctest"
BlueprintName = "MoreMeUITests"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256CC21EC652E0025C7E5"
BuildableName = "MoreMeAI.app"
BlueprintName = "DKMoreMe"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "36A256CC21EC652E0025C7E5"
BuildableName = "MoreMeAI.app"
BlueprintName = "DKMoreMe"
ReferencedContainer = "container:DKMoreMe.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:DKMoreMe.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>DisableBuildSystemDeprecationDiagnostic</key>
<true/>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "B5936392-119E-4778-B5BC-653E4CA87060"
type = "0"
version = "2.0">
</Bucket>
//
// AddressModel.h
// MOFSPickerManager
//
// Created by luoyuan on 16/8/31.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CityModel,DistrictModel,GDataXMLElement;
@interface AddressModel : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *zipcode;
@property (nonatomic, strong) NSString *index;
@property (nonatomic, strong) NSMutableArray<CityModel *> *list;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@end
@interface CityModel : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *zipcode;
@property (nonatomic, strong) NSString *index;
@property (nonatomic, strong) NSMutableArray<DistrictModel *> *list;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@end
@interface DistrictModel : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *zipcode;
@property (nonatomic, strong) NSString *index;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@end
//
// AddressModel.m
// MOFSPickerManager
//
// Created by luoyuan on 16/8/31.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import "AddressModel.h"
@implementation AddressModel
- (NSMutableArray *)list {
if (!_list) {
_list = [NSMutableArray array];
}
return _list;
}
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self) {
if (dictionary) {
self.name = dictionary[@"name"];
self.zipcode = dictionary[@"zipcode"];
}
}
return self;
}
@end
@implementation CityModel
- (NSMutableArray *)list {
if (!_list) {
_list = [NSMutableArray array];
}
return _list;
}
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self) {
if (dictionary) {
self.name = dictionary[@"name"];
self.zipcode = dictionary[@"zipcode"];
}
}
return self;
}
@end
@implementation DistrictModel
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self) {
if (dictionary) {
self.name = dictionary[@"name"];
self.zipcode = dictionary[@"zipcode"];
}
}
return self;
}
@end
//
// LQYPickerView.h
// MOFSPickerManagerDemo
//
// Created by luoyuan on 2019/10/22.
// Copyright © 2019 luoyuan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MOFSToolView.h"
NS_ASSUME_NONNULL_BEGIN
@interface LQYPickerViewLayout : NSObject
@property (nonatomic, assign) CGFloat marginLeft;
@property (nonatomic, assign) CGFloat marginRight;
@property (nonatomic, assign) CGFloat marginBottom;
//高度,默认216
@property (nonatomic, assign) CGFloat height;
//默认 44
@property (nonatomic, assign) CGFloat toolBarHeight;
@end
@interface LQYPickerView : UIPickerView
@property (nonatomic, strong) LQYPickerViewLayout *layout;
//背景透明度, 默认0.4
@property (nonatomic, assign) CGFloat maskAlpha;
@property (nonatomic, strong) NSDictionary<NSAttributedStringKey, id> *textAttributes;
@property (nonatomic, strong, readonly) MOFSToolView *toolBar;
@property (nonatomic, strong, readonly) UIView *containerView;
@property (nonatomic, strong, readonly) UIView *maskView;
@property (nonatomic, weak) UIView *parentView;
/**
* 是否为动态,即联动
*/
@property (nonatomic, assign) BOOL isDynamic;
/**
* 级数
* isDynamic = true有效
* 默认值 1
*/
@property (nonatomic, assign) NSInteger numberOfSection;
/**
* 下一层数据源 key值
* isDynamic = true有效
* @{component : key}
*/
@property (nonatomic, strong) NSDictionary<NSNumber *, NSString *> *dataKeys;
/**
* 数据内容key值
* 格式 @{component : key}
* 当数据源类型为NSDictionary或NSObject时调用
* 例如 [@[@{@"name_0" : @"kamio"}, @{@"name_1" : @"nagisa"}]]时,其值应该为@{@0 : @"name_0", @1 : @"name_1"};如果key值都相同,可以只设置一个,例如@{@0 : @"name"}
*/
@property (nonatomic, strong) NSDictionary<NSNumber *, NSString *> *dataTextKeys;
/**
* 数据
* 内容可以是NSString、NSDictionary和NSObject;其中 NSDictionary和NSObject需要提供dataTextKeys来取出内容
* 静态格式:1. @[@"kamio", @"nagisa", @"misuzu"] (一级)
* 2. @[@{@"name" : @"kamio"}, @{@"name" : @"nagisa"}] (一级)
* 3. @[@[@"a", @"b", @"c"], @[@"1", @"2", @"3"]] (多级,取决于最外层数组长度)
* 动态格式:@[@{@"name" : @"广东", @"list" : @[@"深圳", @"广州"]}, @{@"name" : @"广西", @"list" : @[@"南宁", @"桂林"]}];
*/
@property (nonatomic, strong) NSArray *dataArray;
/**
* 确认block
* json格式为 component : component所选中的数据
*/
@property (nonatomic, copy) void (^commitBlock)(NSDictionary<NSNumber *, id> * _Nullable json);
/**
* 获取某个component下的 数组
*/
- (nullable NSArray *)getDataArrayForComponent:(NSInteger)component;
- (void)show;
- (void)dismiss;
@end
typedef NS_ENUM(NSUInteger, LQYDateComponent) {
LQYDateComponentYear = 0,
LQYDateComponentMonth = 1,
LQYDateComponentDay = 2,
LQYDateComponentHour = 3,
LQYDateComponentMinute = 4,
LQYDateComponentSecond = 5
};
typedef NS_ENUM(NSInteger, LQYFormatType) {
LQYFormatTypeBefore = 1, //加在相应字符串前边
LQYFormatTypeAfter = 2, //加在相应字符串后边
};
@interface LQYDatePickerView : LQYPickerView
/**注意:minimumComponent不是LQYDateComponentYear时,请保持minimumDate、maximumDate前面略去的值一致
* 例如 minimumComponent是LQYDateComponentDay,那么请保持最小minimumDate、最大日期maximumDate
* 的年份、月份一致
* 如果不一致,则以小的minimumDate为准
*/
/**
* 最小日期
* 默认:2000-01-01
*/
@property (nullable, nonatomic, strong) NSDate *minimumDate;
/**
* 最大日期
* 默认:当前时间
*/
@property (nullable, nonatomic, strong) NSDate *maximumDate;
/**
* 显示的最小component
* 默认LQYDateComponentYear,从年份开始显示
*/
@property (nonatomic, assign) LQYDateComponent minimumComponent;
/**
* 显示的最大component
* 默认为LQYDateComponentDay,显示到 天 为止
*/
@property (nonatomic, assign) LQYDateComponent maximumComponent;
@property (nonatomic, copy) void (^cancelBlock)(void);
@property (nonatomic, copy) void (^dateCommitBlock)(NSDateComponents *components);
/**
* 设置显示时间格式
*/
- (void)setDateFormat:(NSString *)dateFormat formatType:(LQYFormatType)formatType component:(LQYDateComponent)component;
- (void)showWithCommitBlock:(void(^)(NSDateComponents *components))commitBlock cancelBlock:(void(^)(void))cancelBlock;
@end
NS_ASSUME_NONNULL_END
//
// MOFSAddressPickerView.h
// MOFSPickerManager
//
// Created by luoyuan on 16/8/31.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MOFSToolView.h"
#import "AddressModel.h"
typedef NS_ENUM(NSInteger, SearchType) {
SearchTypeAddress = 0,
SearchTypeZipcode = 1,
SearchTypeAddressIndex = 2,
SearchTypeZipcodeIndex = 3,
};
@interface MOFSAddressPickerView : UIPickerView
@property (nullable, nonatomic, readonly) NSMutableArray<AddressModel *> *addressDataArray;
@property (nonatomic, assign) NSInteger showTag;
@property (nullable, nonatomic, strong) MOFSToolView *toolBar;
@property (nullable, nonatomic, strong) UIView *containerView;
@property (nullable, nonatomic, strong) void (^containerViewClickedBlock)(void);
@property (nonatomic, assign) NSInteger numberOfSection;
@property (nonatomic, assign) BOOL usedXML;
@property (nullable, nonatomic, strong) NSDictionary<NSAttributedStringKey, id> *attributes;
- (void)showMOFSAddressPickerCommitBlock:(void(^_Nullable)(NSString * _Nullable address, NSString * _Nullable zipcode))commitBlock cancelBlock:(void(^_Nullable)(void))cancelBlock;
- (void)searchType:(SearchType)searchType key:(NSString *_Nullable)key block:(void(^_Nullable)(NSString * _Nullable result))block;
@end
//
// MOFSDatePicker.h
// MOFSPickerManager
//
// Created by luoyuan on 16/8/26.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MOFSToolView.h"
typedef void (^CommitBlock)(NSDate *date);
typedef void (^CancelBlock)(void);
@interface MOFSDatePicker : UIDatePicker
@property (nonatomic, strong) MOFSToolView *toolBar;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) void (^containerViewClickedBlock)(void);
- (void)showMOFSDatePickerViewWithFirstDate:(NSDate *)date commit:(CommitBlock)commitBlock cancel:(CancelBlock)cancelBlock;
- (void)showMOFSDatePickerViewWithTag:(NSInteger)tag firstDate:(NSDate *)date commit:(CommitBlock)commitBlock cancel:(CancelBlock)cancelBlock;
@end
//
// MOFSDatePicker.m
// MOFSPickerManager
//
// Created by luoyuan on 16/8/26.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import "MOFSDatePicker.h"
#define UISCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
@interface MOFSDatePicker()
@property (nonatomic, strong) NSMutableDictionary *recordDic;
@property (nonatomic, strong) UIView *bgView;
@end
@implementation MOFSDatePicker
- (NSMutableDictionary *)recordDic {
if (!_recordDic) {
_recordDic = [NSMutableDictionary dictionary];
}
return _recordDic;
}
#pragma mark - create UI
- (instancetype)initWithFrame:(CGRect)frame {
[self initToolBar];
[self initContainerView];
CGRect initialFrame;
if (CGRectIsEmpty(frame)) {
initialFrame = CGRectMake(0, self.toolBar.frame.size.height, UISCREEN_WIDTH, 216);
} else {
initialFrame = frame;
}
self = [super initWithFrame:initialFrame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.datePickerMode = UIDatePickerModeDate;
[self initBgView];
}
return self;
}
- (void)initToolBar {
self.toolBar = [[MOFSToolView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, 44)];
self.toolBar.backgroundColor = UIColorRGB(24, 23, 37);
}
- (void)initContainerView {
self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
self.containerView.userInteractionEnabled = YES;
[self.containerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(containerViewClickedAction)]];
}
- (void)initBgView {
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, UISCREEN_HEIGHT - self.frame.size.height - 44, UISCREEN_WIDTH, self.frame.size.height + self.toolBar.frame.size.height)];
}
#pragma mark - Action
- (void)showMOFSDatePickerViewWithFirstDate:(NSDate *)date commit:(CommitBlock)commitBlock cancel:(CancelBlock)cancelBlock
{
self.date = date;
[self showWithAnimation];
__weak __typeof(self) weakSelf = self;
self.toolBar.cancelBlock = ^{
[weakSelf hiddenWithAnimation];
if (cancelBlock) {
cancelBlock();
}
};
self.toolBar.commitBlock = ^{
[weakSelf hiddenWithAnimation];
if (commitBlock) {
commitBlock(weakSelf.date);
}
};
}
- (void)showMOFSDatePickerViewWithTag:(NSInteger)tag firstDate:(NSDate *)date commit:(CommitBlock)commitBlock cancel:(CancelBlock)cancelBlock {
NSString *showtagStr = [NSString stringWithFormat:@"%ld",(long)tag];
if ([self.recordDic.allKeys containsObject:showtagStr]) {
NSDate *date1 = self.recordDic[showtagStr][showtagStr];
self.date = date1;
} else {
if (date) {
self.date = date;
} else {
self.date = [NSDate date];
}
}
[self showWithAnimation];
__weak __typeof(self) weakSelf = self;
self.toolBar.cancelBlock = ^{
[weakSelf hiddenWithAnimation];
if (cancelBlock) {
cancelBlock();
}
};
self.toolBar.commitBlock = ^{
NSDictionary *dic = [NSDictionary dictionaryWithObject:weakSelf.date forKey:showtagStr];
[weakSelf.recordDic setValue:dic forKey:showtagStr];
[weakSelf hiddenWithAnimation];
if (commitBlock) {
commitBlock(weakSelf.date);
}
};
}
- (void)showWithAnimation {
[self addViews];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
CGFloat height = self.bgView.frame.size.height;
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT + height / 2);
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT - height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}];
}
- (void)hiddenWithAnimation {
CGFloat height = self.bgView.frame.size.height;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT + height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
} completion:^(BOOL finished) {
[self hiddenViews];
}];
}
- (void)containerViewClickedAction {
if (self.containerViewClickedBlock) {
self.containerViewClickedBlock();
}
[self hiddenWithAnimation];
}
- (void)addViews {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[window addSubview:self.containerView];
[window addSubview:self.bgView];
[self.bgView addSubview:self.toolBar];
[self.bgView addSubview:self];
}
- (void)hiddenViews {
[self removeFromSuperview];
[self.toolBar removeFromSuperview];
[self.bgView removeFromSuperview];
[self.containerView removeFromSuperview];
}
@end
//
// MOFSPickerManager.h
// MOFSPickerManager
//
// Created by luoyuan on 16/8/26.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MOFSDatePicker.h"
#import "MOFSPickerView.h"
#import "MOFSAddressPickerView.h"
#import "LQYPickerView.h"
typedef void (^DatePickerCommitBlock)(NSDate * _Nonnull date);
typedef void (^DatePickerCancelBlock)(void);
typedef void (^PickerViewCommitBlock)(NSString * _Nonnull string);
typedef void (^PickerViewCustomCommitBlock)(id _Nullable model);
typedef void (^PickerViewCancelBlock)(void);
@interface MOFSPickerManager : NSObject
+ (MOFSPickerManager *_Nonnull)shareManger;
@property (nonnull, nonatomic, strong) MOFSDatePicker *datePicker;
@property (nonnull, nonatomic, strong) MOFSPickerView *pickView;
@property (nonnull, nonatomic, strong) MOFSAddressPickerView *addressPicker;
@property (nonnull, nonatomic, strong) LQYDatePickerView *lqyDatePicker;;
// ================================DatePicker===================================//
/**
* show default datePicker.
* default datePickerMode : UIDatePickerModeDate.
* default cancelTitle : "取消".
* default commitTitle : "确定".
* default title : "".
* @param tag : will remeber the last date you had select.
*/
- (void)showDatePickerWithTag:(NSInteger)tag commitBlock:(DatePickerCommitBlock _Nullable )commitBlock cancelBlock:(DatePickerCancelBlock _Nullable )cancelBlock;
/**
* show default datePicker with your custom datePickerMode.
* default cancelTitle : "取消".
* default commitTitle : "确定".
* default title : "".
* @param tag : will remeber the last date you had select.
* @param mode : UIDatePickerMode
*/
- (void)showDatePickerWithTag:(NSInteger)tag datePickerMode:(UIDatePickerMode)mode commitBlock:(DatePickerCommitBlock _Nullable )commitBlock cancelBlock:(DatePickerCancelBlock _Nullable )cancelBlock;
/**
* show datePicker with your custom datePickerMode ,title , cancelTitle , commitTitle.
* @param tag : will remeber the last date you had select.
* @param title : toolbar title
* @param cancelTitle : "".
* @param commitTitle : "".
* @param mode : UIDatePickerMode.
*/
- (void)showDatePickerWithTag:(NSInteger)tag title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle datePickerMode:(UIDatePickerMode)mode commitBlock:(DatePickerCommitBlock _Nullable )commitBlock cancelBlock:(DatePickerCancelBlock _Nullable )cancelBlock;
/**
* show datePicker with your custom datePickerMode ,firstDate , minDate , maxDate.
* @param firstDate : show date.
* @param minDate : minimumDate.
* @param maxDate : maximumDate.
* @param mode : UIDatePickerMode.
*/
- (void)showDatePickerWithTag:(NSInteger)tag firstDate:(NSDate *_Nullable)firstDate minDate:(NSDate *_Nullable)minDate maxDate:(NSDate *_Nullable)maxDate datePickerMode:(UIDatePickerMode)mode commitBlock:(DatePickerCommitBlock _Nullable )commitBlock cancelBlock:(DatePickerCancelBlock _Nullable )cancelBlock;
/**
* show datePicker with your custom datePickerMode ,firstDate ,title , cancelTitle , commitTitle , minDate , maxDate.
* @param title : toolbar title
* @param cancelTitle : "".
* @param commitTitle : "".
* @param firstDate : show date.
* @param minDate : minimumDate.
* @param maxDate : maximumDate.
* @param mode : UIDatePickerMode.
* @param tag : will remeber the last date you had select.
*/
- (void)showDatePickerWithTitle:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle firstDate:(NSDate *_Nullable)firstDate minDate:(NSDate *_Nullable)minDate maxDate:(NSDate *_Nullable)maxDate datePickerMode:(UIDatePickerMode)mode tag:(NSInteger)tag commitBlock:(DatePickerCommitBlock _Nullable )commitBlock cancelBlock:(DatePickerCancelBlock _Nullable )cancelBlock;
// ================================pickerView===================================//
- (void)showPickerViewWithDataArray:(NSArray<NSString *> *_Nullable)array title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(PickerViewCommitBlock _Nullable )commitBlock cancelBlock:(PickerViewCancelBlock _Nullable )cancelBlock;
- (void)showPickerViewWithDataArray:(NSArray<NSString *> *_Nullable)array tag:(NSInteger)tag title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(PickerViewCommitBlock _Nullable )commitBlock cancelBlock:(PickerViewCancelBlock _Nullable )cancelBlock;
- (void)showPickerViewWithCustomDataArray:(NSArray *_Nullable)array keyMapper:(NSString *_Nullable)keyMapper title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(PickerViewCustomCommitBlock _Nullable)commitBlock cancelBlock:(PickerViewCancelBlock _Nullable )cancelBlock;
- (void)showPickerViewWithCustomDataArray:(NSArray *_Nullable)array keyMapper:(NSString *_Nullable)keyMapper tag:(NSInteger)tag title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(PickerViewCustomCommitBlock _Nullable)commitBlock cancelBlock:(PickerViewCancelBlock _Nullable )cancelBlock;
//===============================addressPicker===================================//
/**
* show addressPicker with your custom title, cancelTitle, commitTitle
*
* @param title your custom title
* @param cancelTitle your custom cancelTitle
* @param commitTitle your custom commitTitle
* @param commitBlock commitBlock
* @param cancelBlock cancelBlock
*/
- (void)showMOFSAddressPickerWithTitle:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(void(^_Nullable)(NSString * _Nullable address, NSString * _Nullable zipcode))commitBlock cancelBlock:(void(^_Nullable)(void))cancelBlock;
/**
* show addressPicker with your custom title, cancelTitle, commitTitle
*
* @param title your custom title
* @param address default address
* @param cancelTitle your custom cancelTitle
* @param commitTitle your custom commitTitle
* @param commitBlock commitBlock
* @param cancelBlock cancelBlock
*/
- (void)showMOFSAddressPickerWithDefaultAddress:(NSString *_Nullable)address title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(void(^_Nullable)(NSString * _Nullable address, NSString * _Nullable zipcode))commitBlock cancelBlock:(void(^_Nullable)(void))cancelBlock;
/**
* show addressPicker with your custom title, cancelTitle, commitTitle
*
* @param zipcode default zipcode
* @param title your custom title
* @param cancelTitle your custom cancelTitle
* @param commitTitle your custom commitTitle
* @param commitBlock commitBlock
* @param cancelBlock cancelBlock
*/
- (void)showMOFSAddressPickerWithDefaultZipcode:(NSString *_Nullable)zipcode title:(NSString *_Nullable)title cancelTitle:(NSString *_Nullable)cancelTitle commitTitle:(NSString *_Nullable)commitTitle commitBlock:(void(^_Nullable)(NSString * _Nullable address, NSString * _Nullable zipcode))commitBlock cancelBlock:(void(^_Nullable)(void))cancelBlock;
/**
* searchAddressByZipcode
*
* @param zipcode zipcode
* @param block block
*/
- (void)searchAddressByZipcode:(NSString *_Nullable)zipcode block:(void(^_Nullable)(NSString * _Nullable address))block;
/**
* searchZipCodeByAddress
*
* @param address address
* @param block block
*/
- (void)searchZipCodeByAddress:(NSString *_Nullable)address block:(void(^_Nullable)(NSString * _Nullable zipcode))block;
/**
* searchIndexByAddress
*
* @param address address
* @param block block
*/
- (void)searchIndexByAddress:(NSString *_Nullable)address block:(void(^_Nullable)(NSString * _Nullable address))block;
/**
* searchIndexByZipCode
*
* @param zipcode address
* @param block block
*/
- (void)searchIndexByZipCode:(NSString *_Nullable)zipcode block:(void(^_Nullable)(NSString * _Nullable address))block;
@end
//
// MOFSPickerView.h
// MOFSPickerManager
//
// Created by luoyuan on 16/8/30.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MOFSToolView.h"
@interface MOFSPickerView : UIPickerView
@property (nonatomic, assign) BOOL needTag;
@property (nonatomic, assign) NSInteger showTag;
@property (nonatomic, strong) MOFSToolView *toolBar;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) void (^containerViewClickedBlock)(void);
@property (nonatomic, strong) NSDictionary<NSAttributedStringKey, id> *attributes;
- (void)showMOFSPickerViewWithDataArray:(NSArray<NSString *> *)array commitBlock:(void(^)(NSString *string))commitBlock cancelBlock:(void(^)(void))cancelBlock;
- (void)showMOFSPickerViewWithCustomDataArray:(NSArray *)array keyMapper:(NSString *)keyMapper commitBlock:(void(^)(id model))commitBlock cancelBlock:(void(^)(void))cancelBlock;
@end
@interface NSString (MOFSPickerView)
@property (nonatomic, copy) NSString *mofs_key;
@property (nonatomic, assign) NSInteger mofs_int_key;
@end
//
// MOFSPickerView.m
// MOFSPickerManager
//
// Created by luoyuan on 16/8/30.
// Copyright © 2016年 luoyuan. All rights reserved.
//
#import "MOFSPickerView.h"
#import <objc/runtime.h>
#define UISCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
@interface MOFSPickerView() <UIPickerViewDelegate,UIPickerViewDataSource>
@property (nonatomic, strong) NSMutableDictionary *recordDic;
@property (nonatomic, strong) NSMutableArray *dataArr;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, assign) NSInteger selectedRow;
@property (nonatomic, copy) NSString *keyMapper; //自定义解析Key
@end
@implementation MOFSPickerView
#pragma mark - setter
- (void)setAttributes:(NSDictionary<NSAttributedStringKey,id> *)attributes {
_attributes = attributes;
dispatch_async(dispatch_get_main_queue(), ^{
[self reloadAllComponents];
});
}
#pragma mark - gettter
- (NSMutableArray *)dataArr {
if (!_dataArr) {
_dataArr = [NSMutableArray array];
}
return _dataArr;
}
- (NSMutableDictionary *)recordDic {
if (!_recordDic) {
_recordDic = [NSMutableDictionary dictionary];
}
return _recordDic;
}
#pragma mark - create UI
- (instancetype)initWithFrame:(CGRect)frame {
[self initToolBar];
[self initContainerView];
CGRect initialFrame;
if (CGRectIsEmpty(frame)) {
initialFrame = CGRectMake(0, self.toolBar.frame.size.height, UISCREEN_WIDTH, 216);
} else {
initialFrame = frame;
}
self = [super initWithFrame:initialFrame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.delegate = self;
self.dataSource = self;
[self initBgView];
}
return self;
}
- (void)initToolBar {
self.toolBar = [[MOFSToolView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, 44)];
self.toolBar.backgroundColor = UIColorRGB(24, 23, 37);
}
- (void)initContainerView {
self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
self.containerView.userInteractionEnabled = YES;
[self.containerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(containerViewClickedAction)]];
}
- (void)initBgView {
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, UISCREEN_HEIGHT - self.frame.size.height - 44, UISCREEN_WIDTH, self.frame.size.height + self.toolBar.frame.size.height)];
}
#pragma mark - Action
- (void)showMOFSPickerViewWithDataArray:(NSArray<NSString *> *)array commitBlock:(void(^)(NSString *string))commitBlock cancelBlock:(void(^)(void))cancelBlock {
self.keyMapper = nil;
self.dataArr = [NSMutableArray arrayWithArray:array];
[self reloadAllComponents];
self.selectedRow = 0;
NSString *tagStr = [NSString stringWithFormat:@"%ld",(long)self.showTag];
if (self.needTag)
{
if ([self.recordDic.allKeys containsObject:tagStr]) {
self.selectedRow = [self.recordDic[tagStr] integerValue];
}
}
[self selectRow:self.selectedRow inComponent:0 animated:NO];
[self showWithAnimation];
__weak __typeof(self) weakSelf = self;
self.toolBar.cancelBlock = ^ {
if (cancelBlock) {
[weakSelf hiddenWithAnimation];
cancelBlock();
}
};
self.toolBar.commitBlock = ^ {
[weakSelf hiddenWithAnimation];
if (commitBlock) {
NSString *rowStr = [NSString stringWithFormat:@"%ld",(long)weakSelf.selectedRow];
[weakSelf.recordDic setValue:rowStr forKey:tagStr];
commitBlock(weakSelf.dataArr[weakSelf.selectedRow]);
}
};
}
- (void)showMOFSPickerViewWithCustomDataArray:(NSArray *)array keyMapper:(NSString *)keyMapper commitBlock:(void (^)(id))commitBlock cancelBlock:(void (^)(void))cancelBlock {
self.keyMapper = keyMapper;
if (keyMapper == nil) {
self.dataArr = [NSMutableArray array];
} else {
self.dataArr = [NSMutableArray arrayWithArray:array];
}
[self reloadAllComponents];
self.selectedRow = 0;
NSString *tagStr = [NSString stringWithFormat:@"%ld",(long)self.showTag];
if (self.needTag)
{
if ([self.recordDic.allKeys containsObject:tagStr]) {
self.selectedRow = [self.recordDic[tagStr] integerValue];
}
}
[self selectRow:self.selectedRow inComponent:0 animated:NO];
[self showWithAnimation];
__weak __typeof(self) weakSelf = self;
self.toolBar.cancelBlock = ^ {
if (cancelBlock) {
[weakSelf hiddenWithAnimation];
cancelBlock();
}
};
self.toolBar.commitBlock = ^ {
[weakSelf hiddenWithAnimation];
if (commitBlock) {
NSString *rowStr = [NSString stringWithFormat:@"%ld",(long)weakSelf.selectedRow];
[weakSelf.recordDic setValue:rowStr forKey:tagStr];
commitBlock(weakSelf.dataArr[weakSelf.selectedRow]);
}
};
}
- (void)showWithAnimation {
[self addViews];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
CGFloat height = self.bgView.frame.size.height;
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT + height / 2);
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT - height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}];
}
- (void)hiddenWithAnimation {
CGFloat height = self.bgView.frame.size.height;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(UISCREEN_WIDTH / 2, UISCREEN_HEIGHT + height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
} completion:^(BOOL finished) {
[self hiddenViews];
}];
}
- (void)containerViewClickedAction {
if (self.containerViewClickedBlock) {
self.containerViewClickedBlock();
}
[self hiddenWithAnimation];
}
- (void)addViews {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[window addSubview:self.containerView];
[window addSubview:self.bgView];
[self.bgView addSubview:self.toolBar];
[self.bgView addSubview:self];
}
- (void)hiddenViews {
[self removeFromSuperview];
[self.toolBar removeFromSuperview];
[self.bgView removeFromSuperview];
[self.containerView removeFromSuperview];
}
#pragma mark - UIPickerViewDelegate,UIPickerViewDataSource
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return self.dataArr.count;
}
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
return 44;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
if (self.keyMapper) {
id value = [self.dataArr[row] valueForKey:self.keyMapper];
if ([value isKindOfClass:[NSString class]]) {
return value;
} else {
return @"解析出错";
}
}
return self.dataArr[row];
}
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
pickerLabel = [[UILabel alloc] init];;
pickerLabel.textAlignment = NSTextAlignmentCenter;
pickerLabel.font = [UIFont systemFontOfSize:16];
pickerLabel.textColor = [UIColor colorWithRed:12.f/255.f green:14.f/255.f blue:14.f/255.f alpha:1];
}
NSString *text = [self pickerView:pickerView titleForRow:row forComponent:component];
pickerLabel.attributedText = [[NSAttributedString alloc] initWithString:text attributes:_attributes];
return pickerLabel;
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
self.selectedRow = row;
}
@end
@implementation NSString (MOFSPickerView)
@dynamic mofs_key, mofs_int_key;
- (void)setMofs_key:(NSString *)mofs_key {
objc_setAssociatedObject(self, @selector(mofs_key), mofs_key, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSString *)mofs_key {
return objc_getAssociatedObject(self, _cmd);
}
- (void)setMofs_int_key:(NSInteger)mofs_int_key {
objc_setAssociatedObject(self, @selector(mofs_int_key), @(mofs_int_key), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSInteger)mofs_int_key {
return [objc_getAssociatedObject(self, _cmd) integerValue];
}
@end
//
// MOFSToolView.h
// MOFSPickerManagerDemo
//
// Created by luoyuan on 2018/2/5.
// Copyright © 2018年 luoyuan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MOFSToolView : UIView
@property (nonatomic, strong) UILabel *cancelBar;
@property (nonatomic, strong) UILabel *commitBar;
@property (nonatomic, strong) UILabel *titleBar;
/**
default Title: "取消"
*/
@property (nonatomic, strong) NSString *cancelBarTitle;
/**
default Color: [UIColor colorWithRed:0.090 green:0.463 blue:0.906 alpha:1]
*/
@property (nonatomic, strong) UIColor *cancelBarTintColor;
/**
default Title: "完成"
*/
@property (nonatomic, strong) NSString *commitBarTitle;
/**
default Color: [UIColor colorWithRed:0.090 green:0.463 blue:0.906 alpha:1]
*/
@property (nonatomic, strong) UIColor *commitBarTintColor;
/**
default Title: ""
*/
@property (nonatomic, strong) NSString *titleBarTitle;
/**
default Color: [UIColor colorWithRed:0.804 green:0.804 blue:0.804 alpha:1]
*/
@property (nonatomic, strong) UIColor *titleBarTextColor;
@property (nonatomic, strong) void (^cancelBlock)(void);
@property (nonatomic, strong) void (^commitBlock)(void);
@end
//
// MOFSToolView.m
// MOFSPickerManagerDemo
//
// Created by luoyuan on 2018/2/5.
// Copyright © 2018年 luoyuan. All rights reserved.
//
#import "MOFSToolView.h"
#define TEXT_COLOR [UIColor colorWithRed:0.090 green:0.463 blue:0.906 alpha:1]
#define LINE_COLOR [UIColor colorWithRed:0.804 green:0.804 blue:0.804 alpha:1]
#define UISCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
@implementation MOFSToolView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
//self.translatesAutoresizingMaskIntoConstraints = false;
// self.backgroundColor = [UIColor redColor];
_cancelBar = [UILabel new];
_cancelBar.font = [UIFont systemFontOfSize:14];
_cancelBar.textColor = [UIColor whiteColor];
_cancelBar.text = kMultiLangString(@"取消");
_cancelBar.textAlignment = NSTextAlignmentLeft;
_cancelBar.userInteractionEnabled = true;
[_cancelBar addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cancelAction)]];
[self addSubview:_cancelBar];
[_cancelBar setTranslatesAutoresizingMaskIntoConstraints:false];
[_cancelBar setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[_cancelBar setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
_titleBar = [UILabel new];
_titleBar.font = [UIFont systemFontOfSize:14];
_titleBar.textAlignment = NSTextAlignmentCenter;
_titleBar.textColor = LINE_COLOR;
[self addSubview:_titleBar];
[_titleBar setTranslatesAutoresizingMaskIntoConstraints:false];
[_titleBar setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
_commitBar = [UILabel new];
_commitBar.font = [UIFont systemFontOfSize:14];
_commitBar.textColor = [UIColor whiteColor];
_commitBar.text = kMultiLangString(@"完成");
_commitBar.textAlignment = NSTextAlignmentRight;
_commitBar.userInteractionEnabled = true;
[_commitBar addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(commitAction)]];
[self addSubview:_commitBar];
[_commitBar setTranslatesAutoresizingMaskIntoConstraints:false];
[_commitBar setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[_commitBar setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
// UIView *topLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, 0.5)];
// topLineView.backgroundColor = LINE_COLOR;
// [self addSubview:topLineView];
// [topLineView setTranslatesAutoresizingMaskIntoConstraints:false];
UIView *bottomLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 43.5, UISCREEN_WIDTH, 0.5)];
bottomLineView.backgroundColor = LINE_COLOR;
[self addSubview:bottomLineView];
[bottomLineView setTranslatesAutoresizingMaskIntoConstraints:false];
NSLayoutConstraint *constrant_a = [NSLayoutConstraint constraintWithItem:_cancelBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10];
NSLayoutConstraint *constrant_b = [NSLayoutConstraint constraintWithItem:_cancelBar attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_c = [NSLayoutConstraint constraintWithItem:_cancelBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraints:@[constrant_a, constrant_b, constrant_c]];
NSLayoutConstraint *constrant_d = [NSLayoutConstraint constraintWithItem:_titleBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_cancelBar attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
NSLayoutConstraint *constrant_e = [NSLayoutConstraint constraintWithItem:_titleBar attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_f = [NSLayoutConstraint constraintWithItem:_titleBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraints:@[constrant_d, constrant_e, constrant_f]];
NSLayoutConstraint *constrant_g = [NSLayoutConstraint constraintWithItem:_commitBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_titleBar attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
NSLayoutConstraint *constrant_h = [NSLayoutConstraint constraintWithItem:_commitBar attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_i = [NSLayoutConstraint constraintWithItem:_commitBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_j = [NSLayoutConstraint constraintWithItem:_commitBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10];
[self addConstraints:@[constrant_g, constrant_h, constrant_i, constrant_j]];
// NSLayoutConstraint *constrant_k = [NSLayoutConstraint constraintWithItem:topLineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
// NSLayoutConstraint *constrant_l = [NSLayoutConstraint constraintWithItem:topLineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
// NSLayoutConstraint *constrant_m = [NSLayoutConstraint constraintWithItem:topLineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
// NSLayoutConstraint *constrant_n = [NSLayoutConstraint constraintWithItem:topLineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0.5];
// [self addConstraints:@[constrant_k, constrant_l, constrant_m, constrant_n]];
NSLayoutConstraint *constrant_o = [NSLayoutConstraint constraintWithItem:bottomLineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_p = [NSLayoutConstraint constraintWithItem:bottomLineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_q = [NSLayoutConstraint constraintWithItem:bottomLineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
NSLayoutConstraint *constrant_r = [NSLayoutConstraint constraintWithItem:bottomLineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0.5];
[self addConstraints:@[constrant_o, constrant_p, constrant_q, constrant_r]];
}
return self;
}
#pragma mark - Action
- (void)cancelAction {
if (self.cancelBlock) {
self.cancelBlock();
}
}
- (void)commitAction {
if (self.commitBlock) {
self.commitBlock();
}
}
#pragma mark - install
- (void)setCancelBarTitle:(NSString *)cancelBarTitle {
_cancelBarTitle = cancelBarTitle;
if (self.cancelBar) {
self.cancelBar.text = cancelBarTitle;
}
}
- (void)setCancelBarTintColor:(UIColor *)cancelBarTintColor {
_cancelBarTintColor = cancelBarTintColor;
if (self.cancelBar) {
self.cancelBar.tintColor = cancelBarTintColor;
}
}
- (void)setCommitBarTitle:(NSString *)commitBarTitle {
_commitBarTitle = commitBarTitle;
if (self.commitBar) {
self.commitBar.text = commitBarTitle;
}
}
- (void)setCommitBarTintColor:(UIColor *)commitBarTintColor {
_commitBarTintColor = commitBarTintColor;
if (self.commitBar) {
self.commitBar.tintColor = commitBarTintColor;
}
}
- (void)setTitleBarTitle:(NSString *)titleBarTitle {
_titleBarTitle = titleBarTitle;
if (self.titleBar) {
self.titleBar.text = titleBarTitle;
}
}
- (void)setTitleBarTextColor:(UIColor *)titleBarTextColor {
_titleBarTextColor = titleBarTextColor;
if (self.titleBar) {
self.titleBar.textColor = titleBarTextColor;;
}
}
@end
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
//
// DKaddCustomersViewController.h
// MoreMeAI+
//
// Created by jie huang on 2019/3/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKaddCustomersViewController : DKMmBaseViewController
@property(nonatomic,copy)NSString *type;//1 为快速拍照 2为详情拍 3为修改顾客 //4新增顾客
@property(nonatomic,strong)UIImage *img;
@property (nonatomic,copy) NSString *cid;
@property(nonatomic, copy) void(^result)(NSDictionary *dict);
@end
NS_ASSUME_NONNULL_END
//
// DKhjAreaDeatilModel.h
// MoreMeAI+
//
// Created by jie huang on 2019/4/29.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKhjAreaDeatilModel : NSObject
@property(nonatomic,copy) NSString *address;
@property(nonatomic,copy) NSString *clientuuid;
@property(nonatomic,copy) NSString *sex;
@property(nonatomic,copy) NSString *cname;
@property(nonatomic,copy) NSString *arearegion;
@property(nonatomic,copy) NSString *areaprovince;
@property(nonatomic,copy) NSString *matrimony;
@property(nonatomic,copy) NSString *areacity;
@property(nonatomic,copy) NSString *telphone;
@property(nonatomic,copy) NSString *bear;
@property(nonatomic,copy) NSString *clientimg;
@property(nonatomic,copy) NSString *id;
@property(nonatomic,copy) NSString *job;
@property(nonatomic,copy) NSString *email;
@property(nonatomic,copy) NSString *age;
@property(nonatomic,copy) NSString *hasknife;
@property(nonatomic,copy) NSString *birthday;
@property(nonatomic,copy) NSString *areatxt;
@end
NS_ASSUME_NONNULL_END
//
// DKhjAreaDeatilModel.m
// MoreMeAI+
//
// Created by jie huang on 2019/4/29.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKhjAreaDeatilModel.h"
@implementation DKhjAreaDeatilModel
@end
//
// DKhjAreaModel.h
// MoreMeAI+
//
// Created by jie huang on 2019/4/27.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKhjAreaModel : NSObject
@property(nonatomic,strong) NSArray *childs;
@property(nonatomic,copy) NSString *id;
@property(nonatomic,copy) NSString *isdel;
@property(nonatomic,copy) NSString *level;
@property(nonatomic,copy) NSString *name;
@property(nonatomic,copy) NSString *pinyin;
@property(nonatomic,copy) NSString *upid;
@end
NS_ASSUME_NONNULL_END
//
// DKhjAreaModel.m
// MoreMeAI+
//
// Created by jie huang on 2019/4/27.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKhjAreaModel.h"
@implementation DKhjAreaModel
@end
//
// DKaddCustomersView.h
// MoreMeAI+
//
// Created by jie huang on 2019/3/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
//创建协议
@protocol addCustomersViewDelegate <NSObject>
-(void)jumpChooseData:(NSInteger)value; //声明协议方法
-(void)commitBtn_click;
-(void)backBtn_click;
-(void)isRead_click:(UIButton*)btn;
-(void)labelTap:(UITapGestureRecognizer*)gusture;
@end
@interface DKaddCustomersView : UIView
{
UILabel *navTitle;
}
@property(nonatomic,strong)UIView *viewBg;
@property(nonatomic,strong)UIButton *btnMan;//UIButton *btnWoMan
@property(nonatomic,strong)UILabel *btnManLabel;//UIButton *btnWoMan
@property(nonatomic,strong)UIButton *btnWoMan;//UIButton *marryBtn
@property(nonatomic,strong)UILabel *btnWoManLabel;//UIButton *btnWoMan
@property(nonatomic,strong)UIButton *marryBtn;
@property(nonatomic,strong)UILabel *marryBtnLabel;
@property(nonatomic,strong)UIButton *marryBtns;//UIButton *bornBtn
@property(nonatomic,strong)UILabel *marryBtnsLabel;//UIButton *bornBtn
@property(nonatomic,strong)UIButton *bornBtn;
@property(nonatomic,strong)UILabel *bornBtnLabel;
@property(nonatomic,strong)UIButton *bornBtns;// UIButton *beautyBtn
@property(nonatomic,strong)UILabel *bornBtnsLabel;
@property(nonatomic,strong)UIButton *beautyBtn;
@property(nonatomic,strong)UILabel *beautyBtnLabel;
@property(nonatomic,strong)UIButton *beautyBtns;
@property(nonatomic,strong)UILabel *beautyBtnsLabel;
@property (nonatomic, weak)id<addCustomersViewDelegate> delegate; //声明协议变量
@property(nonatomic,strong)UIButton *bornDay;
@property(nonatomic,strong)UIButton *ageBtn;
@property(nonatomic,strong)NSMutableArray *btnArr;
@property(nonatomic,copy)NSString *sex;
@property(nonatomic,copy)NSString *matrimony;
@property(nonatomic,copy)NSString *bear;
@property(nonatomic,copy)NSString *hasknife;
@property(nonatomic,copy)NSString *type;
@property(nonatomic,strong)UIImageView *headImg;
@property(nonatomic,strong)UIButton *isRead;
@property(nonatomic,strong)UILabel *isReadText;
@property(nonatomic,strong)UILabel *isReadProtocol;
@property(nonatomic,strong)UIButton *backBtn;
@property(nonatomic,strong)UIButton *submitBtn;
-(void)setDataSex:(NSString*)sex matrimony:(NSString*)matrimony bear:(NSString*)bear hasknife:(NSString*)hasknife;
@end
NS_ASSUME_NONNULL_END
//
// webJumpView.h
// DKMoreMe
//
// Created by jie huang on 2019/11/11.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol webJumpViewDelegate <NSObject>
@required //默认修饰符
-(void)backbtn_click;
@end
@interface webJumpView : UIView
@property(nonatomic,copy)NSString *url;
@property (nonatomic, weak) id <webJumpViewDelegate> delegate;//声明代理
@end
NS_ASSUME_NONNULL_END
//
// webJumpView.m
// DKMoreMe
//
// Created by jie huang on 2019/11/11.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "webJumpView.h"
#import <WebKit/WebKit.h>
@implementation webJumpView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self createUI];
}
return self;
}
-(void)createUI{
WKWebView *web = [[WKWebView alloc]init];
web.backgroundColor = [UIColor clearColor];
web.layer.masksToBounds = YES;
web.layer.cornerRadius = 20;
[self addSubview:web];
DKHjUserInfo *info = [DKHjUserInfo share];
NSString *bundleStr;
if ([info.language isEqualToString:@"de"]) {
bundleStr = [[NSBundle mainBundle] pathForResource:@"dewen" ofType:@"html"];
}else{
bundleStr = [[NSBundle mainBundle] pathForResource:@"yinwen" ofType:@"html"];
}
NSURL *url = [NSURL fileURLWithPath:bundleStr];
[web loadRequest:[NSURLRequest requestWithURL:url]];
[web mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@0);
make.top.equalTo(@0);
make.bottom.equalTo(@0);
make.right.equalTo(@0);
}];
UIButton *backBtn = [[UIButton alloc]init];
[backBtn addTarget:self action:@selector(backbtn_click) forControlEvents:UIControlEventTouchUpInside];
[backBtn setImage:[UIImage imageNamed:@"protoBack"] forState:UIControlStateNormal];
[self addSubview:backBtn];
[backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@5);
make.width.equalTo(@50);
make.height.equalTo(@50);
make.right.equalTo(web.mas_right).offset(-10);
}];
}
-(void)backbtn_click{
if (self.delegate && [self.delegate respondsToSelector:@selector(backbtn_click)]) {
[self.delegate backbtn_click];
}
}
@end
//
// DKAnalyzeVC.h
// MoreMeAI+
//
// Created by Alex on 2019/2/20.
// Copyright © 2019年 huangjie. All rights reserved.
//
#import "DKMmBaseViewController.h"
@interface DKAnalyzeVC : DKMmBaseViewController
@property (nonatomic,copy) NSString *cgid;
@property (nonatomic,copy) NSString *cid;
@property (nonatomic,copy) NSString *type;
@property (nonatomic,copy) NSString *aReportId;
@property (nonatomic,copy) NSString *createTime;
@property (nonatomic,copy) NSString *name;
@end
//
// DKAnalyzeVC.m
// MoreMeAI+
//
// Created by Alex on 2019/2/20.
// Copyright © 2019年 huangjie. All rights reserved.
//
#import "DKAnalyzeVC.h"
#import "DKTestReportVC.h"
#import "DKSkinProblemVC.h"
#import "DKHXCSegmentedControl.h"
#import "DKhjHomeViewController.h"
#import "DKSolutionVC.h"
@interface DKAnalyzeVC ()<HXCSegmentedControlDelegate>
@property (nonatomic,strong) DKHXCSegmentedControl *segmentedControl;
@property (nonatomic,strong) UIScrollView *scrollView;
@property (nonatomic, weak) UIViewController *currentVC;
/// 返回按钮
@property (nonatomic,strong) DKHXCButton *backButton;
@property (nonatomic,strong) DKTestReportVC *testReportVC;
@property (nonatomic,strong) DKSkinProblemVC *skinProblemVC;
@property (nonatomic,strong) DKSolutionVC *solutionVC;
@property (nonatomic,strong) UISegmentedControl *segment;
@end
@implementation DKAnalyzeVC
#pragma mark - 系统方法
- (void)viewDidLoad {
[super viewDidLoad];
[self initBaseView];
[self initBaseData];
[self requestData];
[[DKnetWorking share]postupdataUrl:@"esLog/addAnalysisReportEsLog" andDict:nil eventType:@"Report_page"];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
#pragma mark - UI实例化方法
- (void)initBaseView {
kSelfWeak;
UIImageView *bgImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"register_general_bg"]];
bgImg.userInteractionEnabled = YES;
[self.view addSubview:bgImg];
[bgImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(0, 0, 0, 0));
}];
self.view.backgroundColor = [UIColor blackColor];
// _segmentedControl = [DKHXCSegmentedControl segmentedControlWithFrame:CGRectMake(100, 40, 260, 46) TitleArray:@[kMultiLangString(@"分析报告"),kMultiLangString(@"皮肤问题")] lineColor:UIColorHex(0x919CBA) titleColor:UIColorHex(0x4A4A5C) titleSelectColor:UIColorHex(0xAAB8DA) font:kFontSize(20) delegate:self bottomLineColor:[UIColor clearColor]];
// _segmentedControl.centerX = self.view.centerX;
// _segmentedControl.backgroundColor = [UIColor clearColor];
// _segmentedControl.bottomLine.height = 0;
// _segmentedControl.bottomLine.width = 90;
// [self.view addSubview:_segmentedControl];
_segment = [[UISegmentedControl alloc] initWithItems:@[kMultiLangString(@"分析报告"),kMultiLangString(@"解决方案")]];
[_segment addTarget:self action:@selector(segmentValueChanged:) forControlEvents:(UIControlEventValueChanged)];
_segment.layer.masksToBounds = YES;
_segment.selectedSegmentIndex = [self.type integerValue];
_segment.layer.cornerRadius = 8;
_segment.layer.borderWidth = 1.5;
if (@available(iOS 13.0, *)) {
_segment.selectedSegmentTintColor = RGB(67, 75, 123);
} else {
_segment.tintColor = RGB(67, 75, 123);
}
_segment.layer.borderColor = RGB(115, 137, 226).CGColor;
[_segment setTitleTextAttributes:@{NSForegroundColorAttributeName:RGB(170, 184, 218),NSFontAttributeName:kFontSize(17)}forState:UIControlStateNormal];
[_segment setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}forState:UIControlStateSelected];
[self.view addSubview:_segment];
[_segment mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(weakSelf.view);
make.top.equalTo(@45);
make.size.mas_equalTo(CGSizeMake(360, 45));
}];
_backButton = [DKHXCButton buttonWithType:UIButtonTypeCustom];
[_backButton setBackgroundImage:[UIImage imageNamed:@"register_return"] forState:UIControlStateNormal];
// [_backButton setFrame:CGRectMake(20, 26, 20, 32)];
[_backButton addTarget:self action:@selector(backBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_backButton];
[_backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20);
make.top.equalTo(@35);
}];
_testReportVC = [DKTestReportVC new];
_testReportVC.cgid = self.cgid;
_testReportVC.cid = self.cid;
[self addChildViewController:_testReportVC];
// NSString *lang = [NSLocale preferredLanguages].firstObject;
// if ([lang containsString:@"zh-Hans"]) {
// _solutionVC = [DKSolutionVC new];
// _solutionVC.cgid = self.cgid;
// [self addChildViewController:_solutionVC];
// }else {
// _skinProblemVC = [DKSkinProblemVC new];
// _skinProblemVC.cgid = self.cgid;
// [self addChildViewController:_skinProblemVC];
// }
if ([[DKHjUserInfo share].language isEqualToString:@"zh"] ||
[[DKHjUserInfo share].language isEqualToString:@"en"] ||
[[DKHjUserInfo share].language isEqualToString:@"de"]) {
_solutionVC = [DKSolutionVC new];
_solutionVC.cgid = self.cgid;
_solutionVC.cid = self.cid;
[self addChildViewController:_solutionVC];
}else {
_skinProblemVC = [DKSkinProblemVC new];
_skinProblemVC.cgid = self.cgid;
_skinProblemVC.cid = self.cid;
[self addChildViewController:_skinProblemVC];
}
self.currentVC = self.childViewControllers[[self.type integerValue]];
[self.view addSubview:self.currentVC.view];
[self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
}];
}
#pragma mark - 数据源
- (void)initBaseData {
}
#pragma mark - 交互方法
- (void)backBtnAction:(UIButton *)sender{
[self.testReportVC willMoveToParentViewController:nil];
[self.testReportVC removeFromParentViewController];
[self.testReportVC.view removeFromSuperview];
if (self.skinProblemVC) {
[self.skinProblemVC willMoveToParentViewController:nil];
[self.skinProblemVC removeFromParentViewController];
[self.skinProblemVC.view removeFromSuperview];
}
if (self.solutionVC) {
[self.solutionVC willMoveToParentViewController:nil];
[self.solutionVC removeFromParentViewController];
[self.solutionVC.view removeFromSuperview];
}
// if ([self.type isEqualToString:@"1"]) {
// for (UIViewController *temp in self.navigationController.viewControllers) {
// if ([temp isKindOfClass:[DKhjHomeViewController class]]) {
// [self.navigationController popToViewController:temp animated:YES];
// }
// }
// }else{
// [self.navigationController popViewControllerAnimated:YES];
// }
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - 数据处理
#pragma mark - 网络请求
- (void)requestData{
}
#pragma mark - 代理方法
- (void)segmentValueChanged:(UISegmentedControl *)sender
{
kSelfWeak;
if(sender.selectedSegmentIndex == 0)
{
[[DKnetWorking share]postupdataUrl:@"esLog/addAnalysisReportEsLog" andDict:nil eventType:@"Report_report"];
[self.currentVC.view removeFromSuperview];
self.currentVC = self.childViewControllers[0];
[self.view addSubview:self.currentVC.view];
[self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
}];
}
// else if(sender.selectedSegmentIndex == 1)
// {
// [self.currentVC.view removeFromSuperview];
// self.currentVC = self.childViewControllers[1];
// [self.view addSubview:self.currentVC.view];
// [self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
// }];
// }
else {
[[DKnetWorking share]postupdataUrl:@"esLog/addAnalysisReportEsLog" andDict:nil eventType:@"Report_solution"];
[self.currentVC.view removeFromSuperview];
self.currentVC = self.childViewControllers[1];
[self.view addSubview:self.currentVC.view];
[self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
}];
}
}
//- (void)hxcSegmentedControl:(DKHXCSegmentedControl *)hxcSegmentedControl index:(NSInteger)index
//{
//
// kSelfWeak;
// if(index == 0)
// {
// [self.currentVC.view removeFromSuperview];
// self.currentVC = self.childViewControllers[0];
// [self.view addSubview:self.currentVC.view];
// [self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
// }];
// }else
// {
// [self.currentVC.view removeFromSuperview];
// self.currentVC = self.childViewControllers[1];
// [self.view addSubview:self.currentVC.view];
// [self.currentVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(weakSelf.view).insets(UIEdgeInsetsMake(95, 0, 0, 0));
// }];
// }
// [self.scrollView setContentOffset:CGPointMake(index * self.scrollView.width, self.scrollView.contentOffset.y) animated:YES];
// if (index == 0) {
// [self.analyzeViews[0] startWithType:0];
// }
// else
// {
// [self.analyzeViews[0] resetWithType:0];
// [self.analyzeBehindViews[0] resetWithType:3];
// [self.analyzeBehindViews[1] resetWithType:4];
// [self.analyzeBehindViews[2] resetWithType:5];
// }
//
// if (index == 3 || index == 4 || index == 5) {
// [self.analyzeBehindViews[index - 3] startWithType:index];
// }
//}
@end
//
// DKEditSymptomVC.h
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DKSkinProblemModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface DKEditSymptomVC : UIViewController
@property(nonatomic, strong)DKSkinProblemModel *model;
@property(nonatomic, copy)NSString *cid;
@property(nonatomic, copy)void(^updateBlock)(DKSkinProblemModel *model);
@end
NS_ASSUME_NONNULL_END
//
// DKSelectiveSymptomsVC.h
// DKMoreMe
//
// Created by nana on 2019/11/18.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKSelectiveSymptomsVC : UIViewController
@property(nonatomic, assign)NSInteger aReportId;
@property(nonatomic, copy)NSString *cid;
@property(nonatomic, copy)void(^updateBlock)();
@end
NS_ASSUME_NONNULL_END
//
// DKSkinEditVc.h
// MoreMeAI+
//
// Created by pan_macBook on 2019/4/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKMmBaseViewController.h"
#import "DKSkinProblemModel.h"
@protocol SkinEditVcDelegate <NSObject>
- (void)saveData:(DKSkinProblemModel *)model isSave:(BOOL)isSave;
@end
NS_ASSUME_NONNULL_BEGIN
@interface DKSkinEditVc : UIView;
@property (nonatomic,strong) DKSkinProblemModel *model;
@property (nonatomic,assign) BOOL isAdd;
@property (nonatomic,weak) id<SkinEditVcDelegate> delegate;
@property (nonatomic,strong) UIViewController *superCtr;
@property (nonatomic, copy) void(^closeClick)();
- (id)initWithFrame:(CGRect)frame andModel:(DKSkinProblemModel *)model boolIsNew:(BOOL)isNewAdd;
@end
NS_ASSUME_NONNULL_END
//
// DKSkinProblemVC.h
// MoreMeAI+
//
// Created by Alex on 2019/2/22.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKMmBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface DKSkinProblemVC : DKMmBaseViewController
@property (nonatomic,copy) NSString *cgid;
@property (nonatomic,copy) NSString *cid;
@end
NS_ASSUME_NONNULL_END
//
// DKSolutionVC.h
// DKMoreMe
//
// Created by nana on 2019/11/18.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKSolutionVC : UIViewController
@property (nonatomic,copy) NSString *cgid;
@property (nonatomic,copy) NSString *cid;
@end
NS_ASSUME_NONNULL_END
//
// DKTestMaskVC.h
// MoreMeAI+
//
// Created by Alex on 2019/5/15.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKTestMaskVC : UIViewController
@property (nonatomic,strong) UIImage *maskImage;
@end
NS_ASSUME_NONNULL_END
//
// DKTestMaskVC.m
// MoreMeAI+
//
// Created by Alex on 2019/5/15.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKTestMaskVC.h"
@interface DKTestMaskVC ()
@end
@implementation DKTestMaskVC
#pragma mark - 系统方法
- (void)viewDidLoad {
[super viewDidLoad];
[self initBaseView];
[self initBaseData];
[self requestData];
}
#pragma mark - UI实例化方法
- (void)initBaseView {
// code string
}
#pragma mark - 数据源
- (void)initBaseData {
// code string
}
#pragma mark - 交互方法
#pragma mark - 数据处理
#pragma mark - 网络请求
- (void)requestData{
// code string
}
#pragma mark - 代理方法
@end
//
// DKTestReportVC.h
// MoreMeAI+
//
// Created by Alex on 2019/2/22.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKMmBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface DKTestReportVC : DKMmBaseViewController
@property (nonatomic,copy) NSString *cgid;
@property (nonatomic,copy) NSString *cid;
@property (nonatomic,copy) NSString *createTime;
@property (nonatomic,copy) NSString *name;
@end
NS_ASSUME_NONNULL_END
//
// DKSkinProblemModel.h
// MoreMeAI+
//
// Created by Alex on 2019/4/15.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKBaseModel.h"
NS_ASSUME_NONNULL_BEGIN
@class DKSkinProblemGoodsModel;
@class DKSkinProblemReasonModel;
@class DKSkinProblemDermalogicaModel;
@interface DKSkinProblemModel : DKBaseModel
@property (nonatomic,strong) NSMutableArray <DKSkinProblemGoodsModel *> *aGoodsList;
@property (nonatomic,copy) NSString *aReportLinkAitagnameId;
@property (nonatomic,copy) NSString *tagname;
@property (nonatomic,copy) NSString *aitagnameId;
@property (nonatomic,copy) NSString *improve;
@property (nonatomic,copy) NSString *isCustom;
@property (nonatomic,copy) NSString *impact;
@property (nonatomic,strong) NSMutableArray <DKSkinProblemReasonModel *> *aReasonList;
@property (nonatomic,strong) NSMutableArray <DKSkinProblemDermalogicaModel *> *aDermalogicaList;
///辅助属性
@property (nonatomic,assign) CGFloat cellHeight;
@end
@interface DKSkinProblemGoodsModel : NSObject
@property (nonatomic,copy) NSString *goodsId;
@property (nonatomic,copy) NSString *goodsname;
@property (nonatomic,copy) NSString *goodstype;
@property (nonatomic,copy) NSString *icon;
@property (nonatomic,copy) NSString *ID;
@property (nonatomic, strong)NSString *price;
@property (nonatomic, assign)NSInteger status;
@property (nonatomic, assign)BOOL updateImage;
@end
@interface DKSkinProblemReasonModel : DKBaseModel
@property (nonatomic,copy) NSString *reasontext;
@property (nonatomic,copy) NSString *reasonId;
@end
@interface DKSkinProblemDermalogicaModel : DKBaseModel
@property (nonatomic,copy) NSString *dermalogicatext;
@property (nonatomic,copy) NSString *dermalogicaId;
@end
NS_ASSUME_NONNULL_END
//
// DKSkinProblemModel.m
// MoreMeAI+
//
// Created by Alex on 2019/4/15.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKSkinProblemModel.h"
@implementation DKSkinProblemModel
+ (NSDictionary *)mj_objectClassInArray
{
return @{@"aGoodsList" : [DKSkinProblemGoodsModel class],
@"aReasonList" : [DKSkinProblemReasonModel class],
@"aDermalogicaList" : [DKSkinProblemDermalogicaModel class]
};
}
@end
@implementation DKSkinProblemGoodsModel
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{@"ID" : @"id"};
}
@end
@implementation DKSkinProblemReasonModel
@end
@implementation DKSkinProblemDermalogicaModel
@end
//
// DKTestReportModel.h
// MoreMeAI+
//
// Created by Alex on 2019/2/25.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKBaseModel.h"
#import "DKAINumPositionModel.h"
//NS_ASSUME_NONNULL_BEGIN
@interface DKTestReportModel : DKBaseModel
@property (nonatomic,copy) NSString *title;
@property (nonatomic,copy) NSString *detils;
@property (nonatomic,copy) NSString *subTitle;
@property (nonatomic,copy) NSString *bigimage;
@property (nonatomic,copy) NSString *smallimage;
@property (nonatomic,copy) NSString *maskimage;
@property (nonatomic,strong) NSNumber *itype;
@property (nonatomic,strong) NSNumber *porePercentage;
@property (nonatomic,strong) NSString *poreNum;
@property (nonatomic,strong) NSString *spotsArea;
@property (nonatomic,strong) NSNumber *aistanPercentage;
@property (nonatomic,strong) NSNumber *spotsCount;
//新黑头算法判断
@property (nonatomic,strong) NSNumber *averageArea;
@property (nonatomic,strong) NSNumber *wrinklePercentage;
@property (nonatomic,strong) NSNumber *wrinkleLen;
@property (nonatomic,strong) NSString *wrinkleNum;
@property (nonatomic,strong) NSArray *aidiagnosis;
@property (nonatomic,copy) NSString *acneCnt;
@property (nonatomic,copy) NSString *acnePercentage;
@property (nonatomic,copy) NSString *creatTime;
@property (nonatomic,copy) NSString *sensityarea;
@property (nonatomic,copy) NSString *sensityareaPercentage;
@property (nonatomic,strong)UIImage *img;
@end
@interface DKTestReportBaseModel : DKBaseModel
@property (nonatomic,strong) NSArray <DKTestReportModel *>*imageList;
@property (nonatomic,copy) NSString *aiimage;
@property (nonatomic,copy) NSString *date;
@property (nonatomic,copy) NSString *cname;
@property (nonatomic,copy) NSString *isdel;
@property (nonatomic,copy) NSString *totalPoints;
@property (nonatomic,copy) NSString *age;
@property (nonatomic,copy) NSString *aReportId;
/// 病症
@property (nonatomic,strong) NSArray *aReportLinkAitagnameList;
/// 皱纹
@property (nonatomic,copy) NSString *wrinkleMask;
/// 毛孔
@property (nonatomic,copy) NSString *cords;
///
@property (nonatomic,copy) NSString *coordinates;
/// AI病症
@property (nonatomic,copy) NSString *signJson;
/// 宽
@property (nonatomic,assign) int width;
/// 高
@property (nonatomic,assign) int height;
/// 颜色
/// 毛孔
@property (nonatomic,copy) NSString *poreRgba;
/// 色斑
@property (nonatomic,copy) NSString *stainRgba;
/// 黑头
@property (nonatomic,copy) NSString *blackheadAcneRgba;
/// 皱纹
@property (nonatomic,copy) NSString *wrinkleRgba;
@property (nonatomic,copy) NSString *createtime;
@end
@interface DKMaskSizeModel : DKBaseModel
@property (nonatomic,copy) NSString *width;
@property (nonatomic,copy) NSString *height;
@end
@interface DKWrinkleMaskModel : DKBaseModel
@property (nonatomic,strong) DKMaskSizeModel *size;
@property (nonatomic,copy) NSString *rle;
@property (nonatomic,copy) NSString *area;
@property (nonatomic,copy) NSString *class_name;
@property (nonatomic,strong)NSArray *scores;
@property (nonatomic,strong) NSArray <DKAINumPositionModel *> *bboxes;
@property (nonatomic,copy) NSString *num;
@property(nonatomic)byte *byteData;
@property (nonatomic,copy) NSString *rgba;
@end
//NS_ASSUME_NONNULL_END
//
// DKTestReportModel.m
// MoreMeAI+
//
// Created by Alex on 2019/2/25.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKTestReportModel.h"
@implementation DKTestReportModel
@end
@implementation DKTestReportBaseModel
+ (NSDictionary *)mj_objectClassInArray
{
return @{@"imageList":[DKTestReportModel class]};
}
- (NSString *)createtime{
_createtime = [NSString NowDateStrWithDateFormatStrs:_createtime WithDateFormatStr:@"yyyy-MM-dd HH:mm"];
return _createtime;
}
- (NSString *)NowDateStrWithDateFormatStr:(NSString*)dateFormatStr
{
if (!self) {
return @"";
}
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
if ([NSString isNull:dateFormatStr]) {
dateFormatter.dateFormat = @"yyyy-MM-dd";
}
else
{
dateFormatter.dateFormat = dateFormatStr;
}
NSDate *serverDate = [dateFormatter dateFromString:dateFormatStr];
//设置源日期时区
NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];//或GMT
//设置转换后的目标日期时区
NSTimeZone* destinationTimeZone = [NSTimeZone localTimeZone];
// NSTimeZone* destinationTimeZone = [[NSTimeZone alloc] initWithName:@"America/Chicago"];
//得到源日期与世界标准时间的偏移量
NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:serverDate];
//目标日期与本地时区的偏移量
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:serverDate];
//得到时间偏移量的差值
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
//转为现在时间
NSDate* destinationDateNow = [[NSDate alloc] initWithTimeInterval:interval sinceDate:serverDate];
NSString *destinationDateNowStr = [dateFormatter stringFromDate:destinationDateNow];
return destinationDateNowStr;
}
@end
@implementation DKMaskSizeModel
@end
@implementation DKWrinkleMaskModel
+ (NSDictionary *)mj_objectClassInArray
{
return @{@"bboxes":[DKAINumPositionModel class]};
}
@end
//
// DKfindCustomTagnameByMidModel.h
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKfindCustomTagnameByMidModel : DKBaseModel
@property(nonatomic, assign)NSInteger mid;
@property(nonatomic, strong)NSString *tagname;
@end
NS_ASSUME_NONNULL_END
//
// DKfindCustomTagnameByMidModel.m
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKfindCustomTagnameByMidModel.h"
@implementation DKfindCustomTagnameByMidModel
@end
//
// DKfindDermalogicaByMidModel.h
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "DKfindGoodsByMidModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface DKfindDermalogicaByMidModel : NSObject
///主治部位 0-身体 1-面部 2-足部
@property(nonatomic, assign)NSInteger indication;
//护理建议内容
@property(nonatomic, strong)NSString *dermalogicatext;
@property(nonatomic, strong)NSMutableArray <DKfindGoodsByMidModel *>*goodsList;
@property(nonatomic, assign)BOOL selectStatus;
@end
NS_ASSUME_NONNULL_END
//
// DKfindDermalogicaByMidModel.m
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKfindDermalogicaByMidModel.h"
@implementation DKfindDermalogicaByMidModel
+ (NSDictionary *)mj_objectClassInArray
{
return @{@"goodsList":[DKfindGoodsByMidModel class]};
}
@end
//
// DKfindGoodsByMidModel.h
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKfindGoodsByMidLModel : NSObject
@property(nonatomic, assign)NSString *ID;
@property(nonatomic, assign)NSString *goodsId;
@property(nonatomic, strong)NSString *goodsname;
@property(nonatomic, strong)NSString *goodstype;
@property(nonatomic, strong)NSString *icon;
@property(nonatomic, strong)NSString *price;
@property(nonatomic, assign)NSInteger status;
@end
@interface DKfindGoodsByMidModel : DKfindGoodsByMidLModel
@property(nonatomic, strong)NSIndexPath *path;
///选择的时间
@property(nonatomic, assign)NSInteger selectTime;
///是否需要上传图片
@property(nonatomic, assign)BOOL updateImage;
///是否选择
@property(nonatomic, assign)BOOL selectStatus;
@end
NS_ASSUME_NONNULL_END
//
// DKfindGoodsByMidModel.m
// DKMoreMe
//
// Created by nana on 2019/11/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKfindGoodsByMidModel.h"
@implementation DKfindGoodsByMidLModel
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{@"goodsId" : @"id"};
}
@end
@implementation DKfindGoodsByMidModel
@end
//
// ReportPreviewViewController.h
// DKMoreMe
//
// Created by jie huang on 2020/6/1.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ReportPreviewViewController : DKMmBaseViewController
@property(nonatomic,copy)NSString *cid;
@property(nonatomic,copy)NSString *cgid;
@property(nonatomic,strong)NSMutableArray *leftBigImgArray;
/// 皱纹图
@property (nonatomic,strong) UIImage *wrinkleMaskImage;
/// 毛孔图
@property (nonatomic,strong) UIImage *cordsMaskImage;
/// 黑头图
@property (nonatomic,strong) UIImage *coordinatesMaskImg;
///// 病症数组
//@property (nonatomic,strong) NSMutableArray <DKWrinkleMaskModel *> *signJsonArray;
/// 病症图
@property (nonatomic,strong) UIImage *signJsonImage;
/// 敏感图
@property (nonatomic,strong) UIImage *sensitiveMaskImage;
/// 色斑图
@property (nonatomic,strong) UIImage *spotsMaskImage;
@property (nonatomic,strong) UIImageView *spots;
@end
NS_ASSUME_NONNULL_END
//
// EmoticonsHelper.h
// 属性字符串
//
// Created by 吴帮雷 on 2018/5/19.
// Copyright © 2018年 吴帮雷. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface EmoticonsHelper : NSObject
- (NSString *)stringFromImage:(UIImage *)emoticonImage;
@end
//
// EmoticonsHelper.m
// 属性字符串
//
// Created by 吴帮雷 on 2018/5/19.
// Copyright © 2018年 吴帮雷. All rights reserved.
//
#import "EmoticonsHelper.h"
@implementation EmoticonsHelper
//获取图片中文名字
- (NSString *)stringFromImage:(UIImage *)image
{
NSArray *face=[self getAllImagePaths];
NSData * imageD = UIImagePNGRepresentation(image);
NSString * imageName;
for (int i=0; i<face.count; i++)
{
UIImage *image=[UIImage imageNamed:face[i][@"picture"]];
NSData *data=UIImagePNGRepresentation(image);
if ([imageD isEqualToData:data])
{
imageName=face[i][@"key"];
NSLog(@"匹配成功!");
}
}
return imageName;
}
//获取图片数组
-(NSArray *)getAllImagePaths
{
NSBundle *bundle = [NSBundle mainBundle];
NSString * path = [bundle pathForResource:@"tb_png" ofType:@"plist"];
NSArray * face = [[NSArray alloc]initWithContentsOfFile:path];
return face;
}
@end
//
// RadarChartModel.h
// DKMoreMe
//
// Created by jie huang on 2020/6/9.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface RadarChartModel : NSObject
@property(nonatomic,copy)NSString *aReportid;
@property(nonatomic,copy)NSString *acneCnt;
@property(nonatomic,strong)NSArray *diseaseList;
@property(nonatomic,copy)NSString *isDisplayRadarChart;
@property(nonatomic,copy)NSString *poreNum;
@property(nonatomic,copy)NSString *sensityarea;
@property(nonatomic,copy)NSString *sensityareaPercentage;
@property(nonatomic,copy)NSString *spotsArea;
@property(nonatomic,copy)NSString *spotsCount;
@property(nonatomic,copy)NSString *totalPoints;
@property(nonatomic,copy)NSString *wrinkleLen;
@property(nonatomic,copy)NSString *wrinkleNum;
@property(nonatomic,copy)NSString *wrinklePercentage;
@property(nonatomic,copy)NSString *acnePercentage;
@property(nonatomic,copy)NSString *porePercentage;
@property(nonatomic,copy)NSString *spotsPercentage;
@property(nonatomic,copy)NSString *radarPore;
@property(nonatomic,copy)NSString *radarWrinkles;
@property(nonatomic,copy)NSString *radarSpot;
@property(nonatomic,copy)NSString *aiTag;
@property(nonatomic,copy)NSString *radarAcne;
@property(nonatomic,copy)NSString *radarSensitivity;
@end
NS_ASSUME_NONNULL_END
//
// RadarChartModel.m
// DKMoreMe
//
// Created by jie huang on 2020/6/9.
// Copyright © 2020 huangjie. All rights reserved.
//
#import "RadarChartModel.h"
@implementation RadarChartModel
@end
//
// firstPage.h
// DKMoreMe
//
// Created by jie huang on 2020/6/2.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WMZTagCell.h"
#import "tagFiveCell.h"
#import "DKRadarChart.h"
#import "RadarChartModel.h"
#import "setTingModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface firstPage : UIView<WMZTagDelegate>
{
WMZTagCell *tagView;
UIView *RCBgV;
UILabel *pageLabel;
setTingModel *model;
UILabel *allScoreLabel;
}
@property(nonatomic,strong)NSMutableArray *modelArr;
@property (nonatomic, strong) DKRadarDataSet * radarDataSet;
//@property (nonatomic,strong) DKCLTRoundView *roudView;
@property (nonatomic,strong) NSArray *leidaArry;
@property (nonatomic,strong) DKRadarChart * radarChart;
@property (nonatomic,strong)UILabel *detactTime;
@property (nonatomic,strong)UILabel *ageLabel;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *name;
@property (nonatomic,strong)UILabel *age;
@property (nonatomic,strong)UILabel *allScore;
@property (nonatomic,strong)UILabel *noneOne;
@property (nonatomic,strong)UILabel *englishTagView;
@property (nonatomic,strong)UIImageView *headImg;
-(void)setTagName:(NSMutableArray*)arr;
-(void)createChart:(RadarChartModel*)model;
-(void)setPage:(NSString*)page;
-(void)setEnTagName:(NSMutableArray*)arr;
//@property (nonatomic,strong)UILabel *detactTime;
//@property (nonatomic,strong)UILabel *nameLabel;
//@property (nonatomic,strong)UILabel *detactTime;
//@property (nonatomic,strong)UILabel *nameLabel;
@end
NS_ASSUME_NONNULL_END
//
// lastPageOne.h
// DKMoreMe
//
// Created by jie huang on 2020/6/5.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface lastPageOne : UIView
{
UILabel *solution;
UILabel *pageLabel;
}
@property (nonatomic,strong)UILabel *detactTime;
@property (nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UILabel *topLine;
-(void)setUIimage:(NSMutableArray *)arr;
-(void)setName:(NSString *)name andDate:(NSString*)time;
-(void)setPage:(NSString*)page;
@end
NS_ASSUME_NONNULL_END
//
// lastPageOne.m
// DKMoreMe
//
// Created by jie huang on 2020/6/5.
// Copyright © 2020 huangjie. All rights reserved.
//
#import "lastPageOne.h"
@implementation lastPageOne
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self creatUI];
}
return self;
}
-(void)creatUI{
self.backgroundColor = [UIColor whiteColor];
UIImageView *LOGO = [[UIImageView alloc]init];
LOGO.image = [UIImage imageNamed:@"pdf_logo"];
[self addSubview:LOGO];
[LOGO mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@19);
make.left.equalTo(@21);
}];
self.nameLabel = [[UILabel alloc]init];
self.nameLabel.text =kMultiLangString(@"姓名:");
self.nameLabel.textColor = rgba(102, 102, 102, 1);
self.nameLabel.font = [UIFont systemFontOfSize:10];
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(LOGO.mas_right).offset(22);
make.top.equalTo(@28.5);
make.width.lessThanOrEqualTo(@200);
}];
self.detactTime = [[UILabel alloc]init];
self.detactTime.text = kMultiLangString(@"检测时间:");
self.detactTime.textColor = rgba(102, 102, 102, 1);
self.detactTime.font = [UIFont systemFontOfSize:10];
[self addSubview:self.detactTime];
[self.detactTime mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel.mas_right).offset(46.5);
make.top.equalTo(@30);
}];
self.topLine = [[UILabel alloc]init];
self.topLine.backgroundColor = rgba(102, 102, 102, 1);
[self addSubview:self.topLine];
[self.topLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(@20.5);
make.top.equalTo(LOGO.mas_bottom).offset(20.5);
make.height.equalTo(@0.5);
make.right.equalTo(@-20.5);
}];
UILabel *solutionIcon = [[UILabel alloc]init];
solutionIcon.backgroundColor = RGB(102, 102, 102);
solutionIcon.layer.masksToBounds = YES;
solutionIcon.layer.cornerRadius =2;
[self addSubview:solutionIcon];
[solutionIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(22);
make.top.equalTo(self.topLine.mas_bottom).offset(20);
make.height.equalTo(@14.5);
make.width.equalTo(@4);
}];
solution = [[UILabel alloc]init];
solution.text = kMultiLangString(@"模式图");
solution.textColor = rgba(102, 102, 102, 1);
solution.font = [UIFont systemFontOfSize:15];
[self addSubview:solution];
[solution mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(solutionIcon.mas_right).offset(5);
make.top.equalTo(self.topLine.mas_bottom).offset(17.5);
}];
pageLabel = [[UILabel alloc] init];
pageLabel.text = @"-0/0-";
pageLabel.numberOfLines = 0;
pageLabel.textColor = rgba(102, 102, 102, 1);
pageLabel.font = [UIFont systemFontOfSize:11];
[self addSubview:pageLabel];
[pageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.mas_bottom).offset(-10.5);
make.centerX.equalTo(self);
}];
}
-(void)setPage:(NSString*)page{
pageLabel.text = page;
}
-(void)setUIimage:(NSMutableArray *)arr{
[SVProgressHUD dismiss];
for (int i = 0; i< arr.count; i++) {
UIImageView *img = [[UIImageView alloc]init];
img.layer.masksToBounds = YES;
img.layer.cornerRadius = 4;
NSMutableDictionary *dic = arr[i];
img.image = [dic objectForKey:@"image"];
[self addSubview:img];
[img mas_makeConstraints:^(MASConstraintMaker *make) {
if (i<3) {
make.top.equalTo(solution.mas_bottom).offset(15);
make.left.equalTo(self.mas_left).offset(19+i*(165.5+32.5));
}
if (3<= i && i < 6) {
make.left.equalTo(self.mas_left).offset(19+(i-3)*(165.5+32.5));
make.top.equalTo(solution.mas_bottom).offset(15+220.5+9.5);
}
if (i>=6) {
make.left.equalTo(self.mas_left).offset(19+(i-6)*(165.5+32.5));
make.top.equalTo(solution.mas_bottom).offset(15+(220.5+9.5)*2);
}
make.height.equalTo(@220.5);
make.width.equalTo(@165.5);
}];
UILabel *bel = [[UILabel alloc]init];
bel.text = [dic objectForKey:@"name"];
bel.textColor = rgba(255, 255, 255, 1);
bel.font = [UIFont systemFontOfSize:14];
bel.backgroundColor = rgba(0, 0, 0, 0.5);
bel.textAlignment = NSTextAlignmentCenter;
[img addSubview:bel];
[bel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(img.mas_left);
make.right.equalTo(img.mas_right);
make.bottom.equalTo(img.mas_bottom);
make.height.equalTo(@35);
}];
}
}
-(void)setName:(NSString *)name andDate:(NSString*)time{
self.detactTime.text = [NSString stringWithFormat:@"%@%@",kMultiLangString(@"检测时间:"),[NSString NowDateStrWithDateFormatStr:time WithDateFormatStr:nil]];
self.nameLabel.text = [NSString stringWithFormat:@"%@%@",kMultiLangString(@"姓名:"),name];
}
@end
//
// secondPage.h
// DKMoreMe
//
// Created by jie huang on 2020/6/4.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface secondPage : UIView
{
UILabel *pageLabel;
}
@property (nonatomic,strong)UILabel *detactTime;
@property (nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UILabel *topLine;
@property(nonatomic,strong)UIView *lastBgView;
@property(nonatomic,strong)UILabel *solution;
-(void)createUI:(NSMutableArray *)arr isFirstPage:(NSString*)isFirst;
-(void)setName:(NSString *)name andDate:(NSString*)time;
-(void)setPage:(NSString*)page;
@end
NS_ASSUME_NONNULL_END
//
// tagFiveCell.h
// DKMoreMe
//
// Created by jie huang on 2020/6/1.
// Copyright © 2020 huangjie. All rights reserved.
//
#import "WMZTagCell.h"
NS_ASSUME_NONNULL_BEGIN
@interface tagFiveCell : WMZTagCell
@end
NS_ASSUME_NONNULL_END
//
// ReportPreviewViewController.m
// DKMoreMe
//
// Created by jie huang on 2020/6/1.
// Copyright © 2020 huangjie. All rights reserved.
//
#import "tagFiveCell.h"
@implementation tagFiveCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
__weak typeof(self) weakSelf = self;
self.param =
TagParam()
// .wInsertaBleSet(YES)
.wInsertTextClick(^(NSString * _Nonnull text, NSArray * _Nonnull modelArr) {
if ([weakSelf.delegate respondsToSelector:@selector(updateCell:data:)]) {
[weakSelf.delegate updateCell:weakSelf data:modelArr];
}
})
.wMasonrySet(^(MASConstraintMaker * _Nonnull make) {
make.top.left.bottom.mas_equalTo(0);
// make.right.equalTo(self.mas_right).offset(0);
make.width.mas_equalTo(400);
})
.wInsertClick(^(NSInteger index, id _Nonnull model, InsertTextBlock _Nonnull block) {
UIAlertController *alerVC = [UIAlertController alertControllerWithTitle:@"自定义增加标签" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alerVC addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
}];
[alerVC addAction:[UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDestructive) handler:^(UIAlertAction * _Nonnull action) {
UITextField *textfield1 = alerVC.textFields[0];
block(textfield1.text);
}]];
[[WMZTagsTool getCurrentVC] presentViewController:alerVC animated:YES completion:nil];
});
self.myTag = [[WMZTags alloc]initConfigureWithModel:self.param withView:self.contentView];
}
return self;
}
- (void)setModel:(NSArray *)model{
[super setModel:model];
self.param.wDataSet(model);
self.param.wFont = 13;
self.param.wInnerColor = RGB(234, 233, 233);
self.param.paddingTop = 10;
self.param.wColor = rgba(51, 51, 51, 1);
[self.myTag updateUI];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// trdthPage.h
// DKMoreMe
//
// Created by jie huang on 2020/6/5.
// Copyright © 2020 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface trdthPage : UIView
@property(nonatomic,copy)NSString *type;
@property(nonatomic,strong)UILabel *topLine;
@property(nonatomic,strong)UIView *lastView;
-(void)creatView;
@end
NS_ASSUME_NONNULL_END
//
// WMZTagBtn.h
// WMZTags
//
// Created by wmz on 2019/5/24.
// Copyright © 2019年 wmz. All rights reserved.
//
#import "WMZTagParam.h"
#import "WMZTagsTool.h"
NS_ASSUME_NONNULL_BEGIN
/*
*按钮样式
*/
typedef enum : NSUInteger{
BtnNormal = 0,
BtnInsert,
}BtnType;
@interface WMZTagBtn : UIButton
//最大size
@property(nonatomic,assign)CGSize maxSize;
//是否超出最大宽度
@property(nonatomic,assign)BOOL max;
//行数
@property(nonatomic,assign)NSInteger lineCount;
//一行的高度
@property(nonatomic,assign)CGFloat oneLineHeight;
//最大宽度
@property(nonatomic,assign)CGFloat maxWidth;
//文本
@property(nonatomic,copy)NSString *text;
//type
@property(nonatomic,assign)BtnType type;
+ (instancetype)buttonWithType:(UIButtonType)buttonType
WithParam:(WMZTagParam*)param
withTag:(NSInteger)tag
withText:(NSString*)text
BtnType:(BtnType)type;
/**
* 设置按钮样式
*/
- (void)setUpBtnStyle;
/**
* 设置按钮UI
*/
- (void)setUI;
/**
* 定制大小
*/
- (void)setSize;
@end
@interface WMZTagBtn (TagImagePosition)
/**
* 利用UIButton的titleEdgeInsets和imageEdgeInsets来实现文字和图片的自由排列
* 注意:这个方法需要在设置图片和文字之后才可以调用,且button的大小要大于 图片大小+文字大小+spacing
*
* @param spacing 图片和文字的间隔
*/
- (void)TagSetImagePosition:(TagImagePosition)postion spacing:(CGFloat)spacing;
@end
NS_ASSUME_NONNULL_END
//
// WMZTagCell.h
// WMZTags
//
// Created by wmz on 2019/8/26.
// Copyright © 2019 wmz. All rights reserved.
//
#import "WMZTags.h"
NS_ASSUME_NONNULL_BEGIN
@protocol WMZTagDelegate <NSObject>
@optional //非必实现的方法
//用于外部刷新
-(void)updateCell:(id)cell data:(NSArray*)data;
@end
@interface WMZTagCell : UITableViewCell
//数据
@property(nonatomic,strong)NSArray *model;
//代理
@property(nonatomic,weak)id<WMZTagDelegate> delegate;
//model
@property(nonatomic,strong)WMZTagParam* param;
//tag
@property(nonatomic,strong)WMZTags *myTag;
@end
NS_ASSUME_NONNULL_END
//
// WMZTagCell.m
// WMZTags
//
// Created by wmz on 2019/8/26.
// Copyright © 2019 wmz. All rights reserved.
//
#import "WMZTagCell.h"
@implementation WMZTagCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// WMZTagConfig.h
// WMZTags
//
// Created by wmz on 2019/9/10.
// Copyright © 2019 wmz. All rights reserved.
//
#ifndef WMZTagConfig_h
#define WMZTagConfig_h
#import <UIKit/UIKit.h>
#import "Masonry.h"
#define MColor [WMZTagsTool stringTOColor:@"#5297E1"]
#define MInnerColor [WMZTagsTool stringTOColor:@"#CEE1F7"]
#define MBoderColor [WMZTagsTool stringTOColor:@"#5297E1"]
#define MSelectColor [WMZTagsTool stringTOColor:@"#ED4985"]
#define MSelectInnerColor [WMZTagsTool stringTOColor:@"#F4C4C4"]
#define MSelectBoderColor [WMZTagsTool stringTOColor:@"#ED4985"]
#define MInsertPlaceholder @"+New tag"
#define TagWitdh [UIScreen mainScreen].bounds.size.width
#define TagHeight [UIScreen mainScreen].bounds.size.height
#define WMZPropStatementAndPropSetFuncStatement(propertyModifier,className, propertyPointerType, propertyName) \
@property(nonatomic,propertyModifier)propertyPointerType propertyName; \
- (className * (^) (propertyPointerType propertyName)) propertyName##Set;
#define WMZPropSetFuncImplementation(className, propertyPointerType, propertyName) \
- (className * (^) (propertyPointerType propertyName))propertyName##Set{ \
return ^(propertyPointerType propertyName) { \
_##propertyName = propertyName; \
return self; \
}; \
}
#endif /* WMZTagConfig_h */
//
// WMZTagParam.m
// WMZTags
//
// Created by wmz on 2019/5/23.
// Copyright © 2019年 wmz. All rights reserved.
//
#import "WMZTagParam.h"
@implementation WMZTagParam
WMZPropSetFuncImplementation(WMZTagParam, TagColorType , wType)
WMZPropSetFuncImplementation(WMZTagParam, Boolean , wClosable)
WMZPropSetFuncImplementation(WMZTagParam, Boolean, wInsertaBle)
WMZPropSetFuncImplementation(WMZTagParam, NSString*, wInsertPlaceholder)
WMZPropSetFuncImplementation(WMZTagParam, Boolean, wSelectOne)
WMZPropSetFuncImplementation(WMZTagParam, Boolean, wSelectMore)
WMZPropSetFuncImplementation(WMZTagParam, TagAlign, wTagAlign)
WMZPropSetFuncImplementation(WMZTagParam, Boolean , wHit)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, wRadius)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, wBoderWidth)
WMZPropSetFuncImplementation(WMZTagParam, UIColor*, wBoderColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor* , wColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor* , wInnerColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor*, wSelectBoderColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor*, wSelectInnerColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor*, wSelectColor)
WMZPropSetFuncImplementation(WMZTagParam, UIColor* , wBackGroundColor)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat , wFont)
WMZPropSetFuncImplementation(WMZTagParam, NSArray*, wData)
WMZPropSetFuncImplementation(WMZTagParam, NSArray*, wSelectIndexData)
WMZPropSetFuncImplementation(WMZTagParam, TagSizeType , wSize)
WMZPropSetFuncImplementation(WMZTagParam, CGRect, wFrame)
WMZPropSetFuncImplementation(WMZTagParam, TagConstraint, wMasonry)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, marginLeft)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, marginRight)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, marginTop)
WMZPropSetFuncImplementation(WMZTagParam, NSInteger, wSelectMoreMaxCount)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, marginBottom)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, paddingLeft)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, paddingTop)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, btnLeft)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, btnTop)
WMZPropSetFuncImplementation(WMZTagParam, CGFloat, btnPaddingLeft)
WMZPropSetFuncImplementation(WMZTagParam, TagImagePosition, imagePosition)
WMZPropSetFuncImplementation(WMZTagParam, NSString*, textImageName)
WMZPropSetFuncImplementation(WMZTagParam, NSString*, imageName)
WMZPropSetFuncImplementation(WMZTagParam, NSString*, selecTextImageName)
WMZPropSetFuncImplementation(WMZTagParam, NSString*, selectImageName)
- (instancetype)init{
if (self = [super init]) {
_wFont = 14;
_marginTop = 10;
_marginLeft = 10;
_marginBottom = 10;
_marginRight = 10;
_paddingTop = 10;
_paddingLeft = 10;
_btnTop = 30;
_btnLeft = 30;
_btnPaddingLeft = 5;
_wColor = MColor;
_wInnerColor = MInnerColor;
_imagePosition = TagImagePositionRight;
_wBoderColor = MBoderColor;
_wBackGroundColor = [WMZTagsTool stringTOColor:@"#eeeeee"];
_wBoderWidth = 1;
_wRadius = 5;
_wInsertPlaceholder = MInsertPlaceholder;
_wSelectBoderColor = MSelectBoderColor;
_wSelectColor = MSelectColor;
_wSelectInnerColor = MSelectInnerColor;
_wSelectMoreMaxCount = -1;
}
return self;
}
- (NSMutableArray *)selectBtnArr{
if (!_selectBtnArr) {
_selectBtnArr = [NSMutableArray new];
}
return _selectBtnArr;
}
- (NSMutableArray *)cancelSelectDefaultBtnArr{
if (!_cancelSelectDefaultBtnArr) {
_cancelSelectDefaultBtnArr = [NSMutableArray new];
}
return _cancelSelectDefaultBtnArr;
}
WMZTagParam * TagParam(void){
return [WMZTagParam new];
}
- (WMZTagParam *(^)(TagClick))wTapClick{
return ^WMZTagParam*(TagClick wTapClick){
self.tapClick = wTapClick;
return self;
};
}
- (WMZTagParam *(^)(TagMoreClick))wMoreTapClick{
return ^WMZTagParam*(TagMoreClick wMoreTapClick){
self.tagMoreClick = wMoreTapClick;
return self;
};
}
- (WMZTagParam *(^)(CloseClick))wCloseClick{
return ^WMZTagParam*(CloseClick wCloseClick){
self.closeClick = wCloseClick;
return self;
};
}
- (WMZTagParam *(^)(InsertClick))wInsertClick{
return ^WMZTagParam*(InsertClick wCloseClick){
self.insertClick = wCloseClick;
return self;
};
}
- (WMZTagParam *(^)(InsertTextAndDataBlock))wInsertTextClick{
return ^WMZTagParam*(InsertTextAndDataBlock wInsertTextClick){
self.insertTextClick = wInsertTextClick;
return self;
};
}
@end
//
// WMZTags.h
// WMZTags
//
// Created by wmz on 2019/5/23.
// Copyright © 2019年 wmz. All rights reserved.
//
#import "WMZTagParam.h"
#import "WMZTagBtn.h"
NS_ASSUME_NONNULL_BEGIN
@interface WMZTags : UIView
//传入的属性
@property(nonatomic,strong)WMZTagParam *param;
/**
* 调用方法
*
*/
- (instancetype)initConfigureWithModel:(WMZTagParam *)param withView:(UIView*)parentView;
/**
* 更新方法
*
*/
- (void)updateUI;
@end
NS_ASSUME_NONNULL_END
//
// WMZTagsTool.h
// WMZTags
//
// Created by wmz on 2019/9/3.
// Copyright © 2019 wmz. All rights reserved.
//
#import "WMZTagConfig.h"
NS_ASSUME_NONNULL_BEGIN
@interface WMZTagsTool : NSObject
//文字转图片
+ (UIImage *)imageWithString:(NSString *)string
font:(UIFont *)font
width:(CGFloat)width
textAlignment:(NSTextAlignment)textAlignment
backColor:(UIColor*)backGroundcolor
color:(UIColor*)color;
//获取当前VC
+ (UIViewController *)getCurrentVC;
//16进制颜色
+ (UIColor *)stringTOColor:(NSString *)str;
@end
NS_ASSUME_NONNULL_END
//
// WMZTagsTool.m
// WMZTags
//
// Created by wmz on 2019/9/3.
// Copyright © 2019 wmz. All rights reserved.
//
#import "WMZTagsTool.h"
@implementation WMZTagsTool
+ (UIImage *)imageWithString:(NSString *)string
font:(UIFont *)font
width:(CGFloat)width
textAlignment:(NSTextAlignment)textAlignment
backColor:(UIColor*)backGroundcolor
color:(UIColor*)color
{
NSDictionary *attributeDic = @{NSFontAttributeName:font};
CGSize size = [string boundingRectWithSize:CGSizeMake(width, 10000)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine
attributes:attributeDic
context:nil].size;
if ([UIScreen.mainScreen respondsToSelector:@selector(scale)])
{
if (UIScreen.mainScreen.scale == 2.0)
{
UIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
} else
{
UIGraphicsBeginImageContext(size);
}
}
else
{
UIGraphicsBeginImageContext(size);
}
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor clearColor] set];
CGRect rect = CGRectMake(0, 0, size.width + 1, size.height + 1);
CGContextFillRect(context, rect);
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = textAlignment;
NSDictionary *attributes = @ {
NSForegroundColorAttributeName:color,
NSFontAttributeName:font,
NSParagraphStyleAttributeName:paragraph
};
[string drawInRect:rect withAttributes:attributes];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
//获取当前VC
+ (UIViewController *)getCurrentVC
{
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
return currentVC;
}
+ (UIViewController *)getCurrentVCFrom:(UIViewController *)rootVC
{
UIViewController *currentVC;
if ([rootVC presentedViewController]) {
// 视图是被presented出来的
rootVC = [rootVC presentedViewController];
}
if ([rootVC isKindOfClass:[UITabBarController class]]) {
// 根视图为UITabBarController
currentVC = [self getCurrentVCFrom:[(UITabBarController *)rootVC selectedViewController]];
} else if ([rootVC isKindOfClass:[UINavigationController class]]){
// 根视图为UINavigationController
currentVC = [self getCurrentVCFrom:[(UINavigationController *)rootVC visibleViewController]];
} else {
// 根视图为非导航类
currentVC = rootVC;
}
return currentVC;
}
//16进制颜色
+ (UIColor *)stringTOColor:(NSString *)str
{
if (!str || [str isEqualToString:@""]) {
return nil;
}
if (![str hasPrefix:@"#"]) {
str = [NSString stringWithFormat:@"#%@",str];
}
NSString *cString = [[str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6) {
return [UIColor clearColor];
}
// strip 0X if it appears
if ([cString hasPrefix:@"0X"])
cString = [cString substringFromIndex:2];
if ([cString hasPrefix:@"#"])
cString = [cString substringFromIndex:1];
if ([cString length] != 6)
return [UIColor clearColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
//r
NSString *rString = [cString substringWithRange:range];
//g
range.location = 2;
NSString *gString = [cString substringWithRange:range];
//b
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f];
}
@end
//
// DKAddNursingMethodCell.h
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class DKfindDermalogicaByMidModel;
@interface DKAddNursingMethodCell : UITableViewCell
@property(nonatomic, strong)UILabel *wb_titleLabel;
@property(nonatomic, strong)UILabel *wb_detailLabel;
@property(nonatomic, strong)DKfindDermalogicaByMidModel *model;
@end
NS_ASSUME_NONNULL_END
//
// DKAddNursingMethodCell.m
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKAddNursingMethodCell.h"
@interface DKAddNursingMethodCell()
@property(nonatomic, strong)UIView *wb_backView;
@property(nonatomic, strong)UIButton *wb_choiceBtn;
@property(nonatomic, strong)UIButton *wb_moreBtn;
@end
@implementation DKAddNursingMethodCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self setupUI];
}
return self;
}
- (void)setupUI {
self.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.wb_backView = [[UIView alloc] init];
self.wb_backView.backgroundColor = rgba(40, 40, 53, 1);
self.wb_backView.layer.cornerRadius = 10;
[self.contentView addSubview:self.wb_backView];
self.wb_titleLabel = [[UILabel alloc] init];
self.wb_titleLabel.text = @"wb_titleLabel";
self.wb_titleLabel.font = kFontSize(14);
self.wb_titleLabel.textColor = [UIColor whiteColor];
[self.wb_backView addSubview:self.wb_titleLabel];
self.wb_detailLabel = [[UILabel alloc] init];
self.wb_detailLabel.text = @"wb_detailLabel";
self.wb_detailLabel.font = kFontSize(14);
self.wb_detailLabel.numberOfLines = 2;
self.wb_detailLabel.textColor = rgba(170, 184, 218, 1);
[self.wb_backView addSubview:self.wb_detailLabel];
self.wb_choiceBtn = [[UIButton alloc] init];
[self.wb_choiceBtn setImage:[UIImage imageNamed:@"xz_kk_nor"] forState:UIControlStateNormal];
[self.wb_choiceBtn setImage:[UIImage imageNamed:@"xz_kk_sel"] forState:UIControlStateSelected];
self.wb_choiceBtn.userInteractionEnabled = NO;
[self.wb_backView addSubview:self.wb_choiceBtn];
self.wb_moreBtn = [[UIButton alloc] init];
self.wb_moreBtn.contentEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);
[self.wb_moreBtn setImage:[UIImage imageNamed:@"hl_zk"] forState:UIControlStateNormal];
[self.wb_moreBtn setImage:[UIImage imageNamed:@"hl_ss"] forState:UIControlStateSelected];
[self.wb_moreBtn addTarget:self action:@selector(moreBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.wb_backView addSubview:self.wb_moreBtn];
[self.wb_backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsMake(10, 31, 10, 31));
}];
[self.wb_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(20);
}];
[self.wb_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(20);
make.right.mas_equalTo(-47);
make.top.equalTo(self.wb_titleLabel.mas_bottom).offset(15);
make.bottom.mas_equalTo(-20);
}];
[self.wb_choiceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(20);
make.right.mas_equalTo(-20);
}];
[self.wb_moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.wb_choiceBtn);
make.centerY.equalTo(self.wb_detailLabel.mas_bottom).offset(-10);
}];
}
- (void)moreBtnClick:(UIButton *)btn {
btn.selected = !btn.selected;
if (btn.selected) {
self.wb_detailLabel.numberOfLines = 0;
}else {
self.wb_detailLabel.numberOfLines = 2;
}
[[self mytb] reloadData];
}
- (UITableView *)mytb {
for (UIView *view = self; view; view = view.superview) {
UIResponder *nextResponder = [view nextResponder];
if ([nextResponder isKindOfClass:[UITableView class]]) {
return (UITableView *)nextResponder;
}
}
return nil;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
self.wb_choiceBtn.selected = selected;
}
@end
//
// DKAddNursingMethodView.h
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DKSkinProblemModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface DKAddNursingMethodView : UIView
@property(nonatomic, strong)UITableView *mainTableView;
@property(nonatomic, strong)NSArray *dataArray;
@property(nonatomic, strong)UIButton *disBtn;
@property(nonatomic, copy)void (^saveBlock)(NSString *selectString);
- (void)nodataViewShow:(BOOL)show;
@property(nonatomic, strong)DKSkinProblemModel *model;
@end
NS_ASSUME_NONNULL_END
//
// DKAddReProjectCell.h
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DKAddReProjectCell : UITableViewCell
@property(nonatomic,strong)UIImageView *wb_iconImageView;
@property(nonatomic,strong)UILabel *wb_titleLabel;
@property(nonatomic,strong)UILabel *wb_priceLabel;
@property(nonatomic,strong)UIButton *wb_typeBtn;
@end
NS_ASSUME_NONNULL_END
//
// DKAddReProjectCell.m
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import "DKAddReProjectCell.h"
@interface DKAddReProjectCell()
@property(nonatomic,strong)UIView *wb_backView;
@property(nonatomic,strong)UIButton *wb_choiceBtn;
@end
@implementation DKAddReProjectCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self stupUI];
}
return self;
}
- (void)stupUI {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.wb_backView = [[UIView alloc] init];
self.wb_backView.backgroundColor = rgba(40, 40, 53, 1);
self.wb_backView.layer.cornerRadius = 10;
[self.contentView addSubview:self.wb_backView];
self.wb_iconImageView = [[UIImageView alloc] init];
self.wb_iconImageView.layer.cornerRadius = 5;
self.wb_iconImageView.layer.masksToBounds = YES;
[self.wb_backView addSubview:self.wb_iconImageView];
self.wb_titleLabel = [[UILabel alloc] init];
self.wb_titleLabel.numberOfLines = 2;
self.wb_titleLabel.text = @" ";
self.wb_titleLabel.font = kFontSize(14);
self.wb_titleLabel.textColor = rgba(255, 255, 255, 1);
[self.wb_backView addSubview:self.wb_titleLabel];
self.wb_priceLabel = [[UILabel alloc] init];
self.wb_priceLabel.text = @"$ 99";
self.wb_priceLabel.font = kFontSize(14);
self.wb_priceLabel.textColor = rgba(170, 184, 218, 1);
[self.wb_backView addSubview:self.wb_priceLabel];
self.wb_typeBtn = [[UIButton alloc] init];
self.wb_typeBtn.userInteractionEnabled = NO;
self.wb_typeBtn.layer.cornerRadius = 5;
self.wb_typeBtn.contentEdgeInsets = UIEdgeInsetsMake(4.5, 7, 4.5, 7);
self.wb_typeBtn.backgroundColor = rgba(45, 47, 78, 1);
[self.wb_backView addSubview:self.wb_typeBtn];
self.wb_choiceBtn = [[UIButton alloc] init];
[self.wb_choiceBtn setImage:[UIImage imageNamed:@"xz_kk_nor"] forState:UIControlStateNormal];
[self.wb_choiceBtn setImage:[UIImage imageNamed:@"xz_kk_sel"] forState:UIControlStateSelected];
self.wb_choiceBtn.userInteractionEnabled = NO;
[self.wb_backView addSubview:self.wb_choiceBtn];
[self.wb_backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsMake(10, 30, 10,30));
}];
[self.wb_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(21);
make.bottom.mas_equalTo(-21);
make.size.mas_equalTo(CGSizeMake(56, 56));
}];
[self.wb_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.wb_iconImageView);
make.left.equalTo(self.wb_iconImageView.mas_right).offset(15);
make.right.mas_equalTo(-50);
}];
[self.wb_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.wb_titleLabel.mas_bottom).offset(15);
make.left.equalTo(self.wb_iconImageView.mas_right).offset(15);
}];
[self.wb_typeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.wb_priceLabel.mas_right).offset(2.5);
make.centerY.equalTo(self.wb_priceLabel);
}];
[self.wb_choiceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-20);
make.centerY.equalTo(self.wb_iconImageView);
}];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
self.wb_choiceBtn.selected = selected;
}
@end
//
// DKAddReProjectView.h
// DKMoreMe
//
// Created by nana on 2019/11/19.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DKSkinProblemModel.h"
NS_ASSUME_NONNULL_BEGIN
@class DKfindGoodsByMidModel;
@interface DKAddReProjectView : UIView
@property(nonatomic, strong)NSMutableArray *dataArray;
@property(nonatomic, weak)UIButton *noEditReBtn;
@property(nonatomic, weak)UIButton *editReBtn;
@property(nonatomic, strong)UIButton *disBtn;
@property(nonatomic, strong)UITableView *mainTableView;
@property(nonatomic, copy)void (^saveBlock)();
@property(nonatomic, copy)void (^editBlock)();
- (void)nodataViewShow:(BOOL)show;
- (void)checkSave;
- (void)updateSelectPath;
- (void)deleteSelectWithModel:(DKfindGoodsByMidModel *)model;
@property(nonatomic, strong)DKSkinProblemModel *model;
@end
NS_ASSUME_NONNULL_END
//
// DKCollectScrollCell.h
// MoreMeAI+
//
// Created by pan_macBook on 2019/4/21.
// Copyright © 2019 huangjie. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DKSkinProblemModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol CollectScrollCellDelegate <NSObject>
- (void)delectOrAddGoods:(NSMutableArray *)dataArry;
@end
@interface DKCollectScrollCell : UITableViewCell
@property (nonatomic,strong)NSMutableArray *dataArry;
@property (nonatomic,weak)id<CollectScrollCellDelegate> delegate;
- (void)setData:(NSMutableArray *)dataArry;
- (void)setShowData:(NSMutableArray *)dataArry;
@end
NS_ASSUME_NONNULL_END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment