通用宏
//
// 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