You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

229 lines
7.0 KiB

//
// myHleper.h
// myWatch
//
// Created by xTT on 16/3/16.
// Copyright © 2016年 xTT. All rights reserved.
//
#ifdef DEBUG
#define xLog(format, ...) printf("\n[%s] %s [第%d行] %s\n", __TIME__, __FUNCTION__, __LINE__, [[NSString stringWithFormat:format, ## __VA_ARGS__] UTF8String]);
#else
#define xLog(format, ...)
#endif
#define WEAKSELF typeof(self) __weak weakSelf = self;
#define dFoneSize 16
#define THEME_NAME @""
#define mainColor RGB(255, 94, 16)
#define mainColorK RGB(255, 175, 141)
#define headOval 8
#define disableColor RGB(204,204,204)
#define BG_Color RGB(255, 150, 1)
#define tabHeaderBG RGB(248, 247, 247)
#define tabFooterBG RGB(248, 247, 247)
#define tabViewBG RGB(248, 247, 247)
#define cellBG [UIColor whiteColor]
/// 浅灰219
#define KKGrey219 RGB(219, 219, 219)
/// 灰143
#define KKGrey143 RGB(143, 156, 179)
/// 灰121
#define KKGrey121 RGB(121, 121, 121)
/// 灰102
#define KKGrey102 RGB(102, 102, 102)
/// 灰153
#define KKGrey153 RGB(153, 153, 153)
/// 黑20
#define KKBlack20 RGB(20, 20, 20)
// #define chatCellBG_Color [UIColor colorWithPatternImage:[UIImage imageNamed:@"像素底纹"]]
#define chatBG_Color [UIColor whiteColor] //[UIColor colorWithPatternImage:[UIImage imageNamed:@"像素底纹"]]
// 39.108.227.227 api.ecellsz.com
//#ifdef DEBUG
//测试环境
//#define xBaseUrl @"http://api.test.ecellsz.com"
//#else
//正式环境
#define xBaseUrl @"http://39.108.227.227"
//#endif
//#define xBaseUrl @"http://39.108.227.227"
//#define xBaseUrl @"http://api.test.ecellsz.com"
//#define xBaseUrl @"https://apitest.tx.kidxin.com"
#define UniversalLinkURL @"https://api.ecellsz.com"
//#define UniversalLinkURL @"http://api.test.ecellsz.com"
#define URL_username @"8e79eb62f0b97f20661b0d68f64a71e6"
#define URL_password @"cea1a8fd4744b0c801a2bd281404a3de"
#define tableFontColor [UIColor colorWithRed:0/255.0 green:174/255.0 blue:217/255.0 alpha:1]//tableView左边字体颜色
#define tableFontGrayColor [UIColor colorWithRed:174/255.0 green:174/255.0 blue:174/255.0 alpha:1]//tableView右边字体颜色
#define RGBHex(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:((float)((rgbValue & 0xFF000000) >> 24))/255.0]
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
#define UICOLOR_RANDOM [UIColor colorWithRed:(arc4random()%255)/255.0 green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:1.0]
#define SWIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SHEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SWIDTH, SHEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SWIDTH, SHEIGHT))
#define IS_IPHONE_4_OR_LESS (SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (SCREEN_MAX_LENGTH == 736.0)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#ifdef IS_IPHONE
#define FIX_SCREEN SWIDTH / 375.0
#elif
#define FIX_SCREEN 1
#endif
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class User;
@interface myHelper : NSObject
+ (UIImage *)getImageWithName:(NSString *)name;
+ (UIFont *)fixFoneSize:(NSInteger)size font:(UIFont *)font;
+ (NSString *)getDateFormatWithStr:(NSString *)dateFormat date:(NSDate *)date;
+ (NSString *)getDateFormatWithStr:(NSString *)dateFormat timeInterval:(NSTimeInterval)timeInterval;
+ (NSDate *)getDateWithStr:(NSString *)dateString dateFormat:(NSString *)dateFormat;
///< 获取当前时间的: 前一周(day:-7)丶前一个月(month:-30)丶前一年(year:-1)的时间 NSDate
+ (NSDate *)ddpGetExpectTimestamp:(NSInteger)year month:(NSUInteger)month day:(NSUInteger)day;
+ (UIColor *)colorWithHexString:(NSString *)color;
/**
根据某点获取颜色
*/
+ (UIColor *)colorAtPixel:(CGPoint)point;
#pragma mark 二维码 URL获取 参数
+ (NSMutableDictionary *)getDicWithUrl:(NSString *)urlStr;
//合成带外框图片
+ (id) createRoundedRectImage:(UIImage*)image addImage:(UIImage *)addImage size:(CGSize)size;
+ (id) createRoundedRectImage:(UIImage*)image addImage:(UIImage *)addImage size:(CGSize)size oval:(CGFloat)oval;
//剪裁&压缩图片
+ (UIImage*) scalingAndCroppingToSize:(CGSize)targetSize withImage:(UIImage*)sourceImage;
#pragma 添加阴影
+ (void)addShadow:(UIImageView *)imageView image:(UIImage *)image;
+ (void)addShadow:(UIImageView *)imageView imageName:(NSString *)imageName;
#pragma 星期选择
+ (NSString *)getWeekDayStr:(NSString *)week;
+ (NSMutableArray *)getWeekStr:(NSString *)string removedNil:(BOOL)isRemoved;
+ (NSMutableArray *)getWeekDayDataArr:(NSArray *)arr;
+ (UIAlertController *)getAlertWithTitle:(NSString *)title
actionTitles:(NSArray *)actionTitles
block:(void (^)(UIAlertAction *action))block;
+ (UIAlertController *)getAlertWithTitle:(NSString *)title
actionTitles:(NSArray *)actionTitles
style:(UIAlertControllerStyle)style
block:(void (^)(UIAlertAction *action))block;
+ (UIAlertController *)getAlertWithTitle:(NSString *)title
message:(NSString *) msg
actionTitles:(NSArray *)actionTitles
style:(UIAlertControllerStyle)style
block:(void (^)(UIAlertAction *action))block;
+ (UIAlertController *)getAlertWithPicture:(void (^)(UIImagePickerController *imagePickerVC))block;
#pragma 获取时间文本
+ (NSMutableString *)secToStr:(NSInteger)sec;
/**
根据传进去的时间返回 字符串
@param beTime 时间 Double
@return 时间 字符串
*/
+ (NSString *)distanceTimeWithBeforeTime:(double)beTime;
+ (void)setBtnUpImageDownTitle:(UIButton *)btn;
/**
获取当前改账号的登录类型
@return 1 手机号登录 2 微信号登录 3 imei号登录 (体验客)
*/
+ (int)getNowAccoutType:(User*)user;
/**
获取 关系名字数组
*/
+(NSArray *)getRelationshipNameArr:(NSInteger)deviceType;
/**
获取 关系未选中的图片数组
*/
+(NSArray *)getUnclickRelationshipImageArr:(NSInteger)deviceType;
/**
获取 关系选中的图片数组
*/
+(NSArray *)getClickRelationshipImageArr:(NSInteger)deviceType;
/**
根据 关系id 获取 关系名字
*/
+(NSString *)getRelationshipNameWithCodeID:(int)code deviceType:(NSInteger)deviceType;
/**
根据 关系id 获取 关系未选中的图片
*/
+(UIImage *)getUnclickRelationshipImageWithCodeID:(int)code deviceType:(NSInteger)deviceType;
/**
根据 关系id 获取 关系选中的图片
*/
+(UIImage *)getClickRelationshipImageWithCodeID:(int)code deviceType:(NSInteger)deviceType;
#pragma mark 获取文本宽度
+ (CGFloat)getWidthWithText:(NSString *)text withFont:(UIFont *)font;
@end