PrefixHeader.pch 2.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//
//  PrefixHeader.pch
//  Car
//
//  Created by Javen on 2016/12/23.
//  Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//

#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#import "ToolHeader.h"

//colors

#define kMainOrangeColor [UIColor colorWithRed:0.89 green:0.44 blue:0.23 alpha:1.00]

//主题色
#define kMainColor kMainOrangeColor

Sandy's avatar
Sandy committed
20
static NSString *const kNotiSelectBill = @"kNotiSelectBill";
21 22 23 24 25 26 27 28 29

#ifdef DEBUG
#define CLog(format, ...)                                                      \
  NSLog((@"[L %d] %s " format), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else
#define CLog(format, ...)
#endif

#define kFalseHttpTips                                                         \
Sandy's avatar
Sandy committed
30 31
  if (response) {                                                        \
    [MBProgressHUD j_error:response[@"message"] complete:nil];           \
32 33
  }

Sandy's avatar
Sandy committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47
//获取APP版本
#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//网络请求数据相关
#define kRsMsg(response) response[@"message"]
#define kRsCode(response) response[@"code"]
#define kRsSuccess(response) [kRsCode(response) isEqualToNumber:@0]
#define kShowRsMsg(response) [MBProgressHUD j_error:kRsMsg(response) complete:nil]

//三目运算符
#define kIf(condition,do,else) condition == YES ? do : else

#define kNoNullStr(string) (string != nil && [string lenth] > 0 ? string : @"")
//拼接string和prefix,拼接后的格式为prefixstring
48 49 50 51 52 53 54 55 56 57 58
#define kStrPrefix(string,prefix) [NSString stringWithFormat:@"%@%@",prefix,[string length] > 0 ? string : @"暂无"]

#ifdef DEBUG

#define kDebugIndex(indexPath) [MBProgressHUD j_textOnly:[NSString stringWithFormat:@"%lu",indexPath.row + 1]];

#else

#define kDebugIndex(indexPath)

#endif
Sandy's avatar
Sandy committed
59

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#define kWindow [UIApplication sharedApplication].keyWindow
#define kBounds [UIScreen mainScreen].bounds
#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#define kAutoValue(value) (float)value / 375 * kWidth
#define WS(weakSelf) __weak __typeof(&*self) weakSelf = self
//收起键盘
#define HIDE_KEYBOARD                                                          \
  [[UIApplication sharedApplication].keyWindow endEditing:YES]

// Include any system framework and library headers here that should be included
// in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of
// your targets to reference this file.

#endif /* PrefixHeader_pch */