
#define 宏
小手一背爱谁谁
这个作者很懒,什么都没留下…
展开
-
iOS 自定义NSLog
//第一种#ifdef DEBUG#define CLog(format, ...) NSLog(format, ## __VA_ARGS__)#else#define CLog(format, ...)#endif// 第二种 #ifdef DEBUG# define DLog(fmt, ...) NSLog((@"[文件名:%s]\n" "[函数原创 2016-06-01 12:14:25 · 1561 阅读 · 0 评论 -
iOS 控制点击事件触发时间间隔
//按钮第二次点击事件触发的等待时间#define Button_Seconds_Time(_seconds_) \static BOOL shouldPrevent; \if (shouldPrevent) return; \shouldPrevent = YES; \dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(...原创 2018-07-17 09:39:31 · 2627 阅读 · 0 评论 -
iOS 接收通知宏
/* 发通知 */#define sendNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj];//pod 'ReactiveCocoa', '2.5'#import "ReactiveCocoa.h"/* RAC收通知免移除 */#define...原创 2018-05-22 10:12:07 · 657 阅读 · 0 评论 -
tableView 设置使用宏定义
//去掉多余的分割线#define TABLEVIEW_FOOTER(tableView)\\[tableView setTableFooterView:[[UIView alloc]initWithFrame:CGRectZero]];// 自适应高度#define TABLEVIEW_AUTOHIGHT(tableView,HIGHT)\\tableView.rowHeight = UITab...原创 2018-02-22 17:25:07 · 207 阅读 · 0 评论 -
Xcode NSLog输出带时间、文件名、行、方法名
// 不带方法名#define NSLog(FORMAT, ...) {\NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\[dateFormatter setDateStyle:NSDateFormatterMediumStyle];\[dateFormatter setTimeSty原创 2017-08-29 19:17:03 · 2153 阅读 · 0 评论 -
完美解决Xcode8.0之后版本NSLog打印输出不全
/** * 完美解决Xcode NSLog打印不全的宏 亲测目前支持到8.2bate版 */#ifdef DEBUG//#define NSLog(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE_...原创 2016-12-02 11:16:53 · 5988 阅读 · 0 评论 -
iOS 常用宏
// --------------屏幕宽高--------------------#define ScreenWidth ([UIScreen mainScreen].bounds.size.width)#define Screenheight ([UIScreen mainScreen].bounds.size.height)// button边框#define BUTTON_BODER(but...原创 2017-01-17 13:55:28 · 549 阅读 · 0 评论 -
iOS 设置视图圆角宏
#define CMViewBorderRadius(View, Radius)\\[View.layer setCornerRadius:(Radius)];\[View.layer setMasksToBounds:YES];原创 2016-08-16 16:26:42 · 366 阅读 · 0 评论 -
iSO 获取通知中心宏
#define MYNotificationCenter [NSNotificationCenter defaultCenter]原创 2016-08-16 16:33:11 · 261 阅读 · 0 评论 -
iOS 获取屏幕宽高宏
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width#define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height原创 2016-08-16 16:32:26 · 4236 阅读 · 0 评论 -
iOS 调试与发布模式自定义显示宏
NSString *str =@"调试模式显示本文字,反之则为空";#ifdef DEBUG# define stitile str;#else# define stitile @"";#endif self.title =stitile;原创 2016-06-20 14:12:01 · 353 阅读 · 0 评论 -
OC 获取一个区间内的随机数的宏
#define RandomNumber(from,to) (int)(from + arc4random() % (to - from + 1))原创 2019-07-10 11:19:09 · 269 阅读 · 0 评论