878
技术社区[云栖]
通用宏
//
// Common.h
// CloudShopping
//
// Created by sixiaobo on 14-7-8.
// Copyright (c) 2014年 com.Uni2uni. All rights reserved.
//
#ifndef CloudShopping_Common_h
#define CloudShopping_Common_h
/*!
* @brief 全局能用宏
*
* @author huangyibiao
*/
// @{
// @name 适配相关
// 判断是否是ios6及其以上版本
#define kIsIOS6OrLater ([UIDevice currentDevice].systemVersion.integerValue >= 6 ? YES : NO)
// 判断是否是ios7及其以上版本
#define kIsIOS7OrLater ([UIDevice currentDevice].systemVersion.integerValue >= 7 ? YES : NO)
// 获取屏幕的高度
#define kScreenHeight ([UIScreen mainScreen].bounds.size.height)
// 用于处理屏幕适配,在ios6和ios7之后的版本之间坐标起点不同
#define kOriginY (kIsIOS7OrLater ? 64.0f : 0.0f)
// @} end
// @{
// @name 颜色相关宏
///< 参数格式为:0xFFFFFF
#define kColorWith16RGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0]
///< 参数格式:22,22,22
#define kColorWithRGB(r, g, b) ([UIColor colorWithRed:(r) / 255.0 \
green:(g) / 255.0 \
blue:(b) / 255.0 \
alpha:1])
///< 参数格式:22,22,22,0.5
#define kColorWithRGBA(r, g, b, a) ([UIColor colorWithRed:(r) / 255.0 \
green:(g) / 255.0 \
blue:(b) / 255.0 \
alpha:(a)])
// @} end
// @{
// @name 字体相关宏
#define kFontWithSize(Size) [UIFont systemFontOfSize:Size]
#define kBoldFontWithSize(Size) [UIFont boldSystemFontOfSize:Size]
// @} end
// @{
// @name 生成图片相关
#define kImageWithName(Name) ([UIImage imageNamed:Name])
#define kBigImageWithName(Name) ([UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:Name ofType:nil]])
// @} end
// @{
// @name 相关单例简化宏、通知
#define kUserDefaults [NSUserDefaults standardUserDefaults]
#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kPostNotificationWithName(notificationName) \
[kNotificationCenter postNotificationName:notificationName object:nil userInfo:nil];
// 询价类型通知,是GPS定位询价还是正常选择城市ID询价,这两个对应不同的接口
#define kAskPriceTypeNotification @"AskPriceTypeNotification"
// @} end
// @{
// @name 全局使用的变量
// 获取自定义的tabbar
#define kTabBar ((HYBRootTabBarController *)self.tabBarController).customTabBar
// @} end
//本地账户数据存储地址
#define kCachePath [NSHomeDirectory() stringByAppendingString:@"/Documents/cache.data"]
#define kInvoicePath [NSHomeDirectory() stringByAppendingString:@"/Documents/invoice.data"]
// 最后一次的购物车中的数据个数
#define kLastCartCountKey @"kLastCartCountKey"
#define kLastTokenKey @"kLastTokenKey"
// 是否需要刷新我的收藏
#define kShouldUpdateCollectionKey @"kShouldUpdateCollectionKey"
#define KRightWaith 245
#define kLightContentViewTag 100000110
#endif
最后更新:2017-04-03 05:39:54