美文网首页
快速开发经验汇总小结(洪)

快速开发经验汇总小结(洪)

作者: BLUEVIPIOS_ | 来源:发表于2017-09-11 17:26 被阅读0次

//字符串是否为空

#define YStringEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )

//数组是否为空

#define YArrayEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)

//字典是否为空

#define YDictEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)

//是否是空对象

#define YObjectIsEmpty(_object) (_object == nil \

||[_objectisKindOfClass:[NSNullclass]]\

||([_objectrespondsToSelector:@selector(length)]&&[(NSData*)_objectlength]==0)\

||([_objectrespondsToSelector:@selector(count)]&&[(NSArray*)_objectcount]==0))

//一些缩写

#define YApplication        [UIApplication sharedApplication]

#define YKeyWindow          [UIApplication sharedApplication].keyWindow

#define YAppDelegate        [UIApplication sharedApplication].delegate

#define YUserDefaults       [NSUserDefaults standardUserDefaults]

#define YNotificationCenter [NSNotificationCenter defaultCenter]

// 通知

// 注册通知

#define NOTIFY_ADD(_noParamsFunc, _notifyName)  [[NSNotificationCenter defaultCenter] \

addObserver:self \

selector:@selector(_noParamsFunc) \

name:_notifyName \

object:nil];

// 发送通知

#define NOTIFY_POST(_notifyName)  [[NSNotificationCenter defaultCenter] postNotificationName:_notifyName object:nil];

// 移除通知

#define NOTIFY_REMOVE(_notifyName) [[NSNotificationCenter defaultCenter] removeObserver:self name:_notifyName object:nil];

#define YImageNamed(s)  [UIImage imageNamed:s]

//APP版本号

#define YAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//系统版本号

#define YSystemVersion [[UIDevice currentDevice] systemVersion]

//获取沙盒Document路径

#define YDocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]

//获取沙盒temp路径

#define YTempPath NSTemporaryDirectory()

//获取沙盒Cache路径

#define YCachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]

//判断是真机还是模拟器

#if TARGET_OS_IPHONE

//真机

#endif

#if TARGET_IPHONE_SIMULATOR

//模拟器

#endif

//开发的时候打印,但是发布的时候不打印的NSLog

#ifdef DEBUG

#define NSLog(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])

#else

#define NSLog(...)

#endif

//颜色

#define YRGBColor(r, g, b)     [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

//由角度转换弧度

#define kDegreesToRadian(x)      (M_PI * (x) / 180.0)

//由弧度转换角度

#define kRadianToDegrees(radian) (radian * 180.0) / (M_PI)

//获取一段时间间隔

#define kStartTime CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();

#define kEndTime   NSLog(@"Time: %f", CFAbsoluteTimeGetCurrent() - start)

// 导航

#define PUSH(VC) [self.navigationController pushViewController:VC animated:YES];

#define POPVC [self.navigationController popViewControllerAnimated:YES];

#define POPTOROOT [self.navigationController popToRootViewControllerAnimated:YES];

持续更新小结

相关文章

  • 快速开发经验汇总小结(洪)

    //字符串是否为空 #define YStringEmpty(str) ([str isKindOfClass:[...

  • 习文炼字|汇总

    目录.习文炼字@及聿 【汇总篇】有效文章:习文炼字|满月小结习文炼字|二月汇总习文炼字|小结汇总习文炼字|先制定个...

  • 邮件模板开发经验小结

    一个有一定用户量的网站总是免不了会有消息模板,邮件模板之类的需求。我们一般通过这类功能向用户推送一些消息,及时给用...

  • React Native开发经验小结

    使用shouldComponentUpdate React提供了这个生命周期函数,来决定是否需要重新渲染该组件,为...

  • spring boot开发经验汇总

    本文记录了Spring boot开发过程中遇到的一些坑,整理一下,希望能够帮助大家 spring boot工程在E...

  • 小程序开发经验汇总

    1、申请主体为个人的小程序审核贼慢 企业小程序就快很多了,一般1天内可以过2~3次 2、设置view或其他元素宽度...

  • react开发,日常经验汇总

    npm升级package.json依赖包到最新版本号 使用工具包:npm-check-updates 全局安装nc...

  • README

    Android 学习之路 常用网站: 1. Android开发套件 2. 开源项目汇总 经验之谈: 1....

  • Android 快速开发框架汇总

    1. Arm框架 [https://github.com/JessYanCoding/MVPArms] 快速搭...

  • bootstrap常用类名

    为了方便快速开发,小结常用bootstrap类名,熟练记忆 栅格类:col-xs/sm/md/lg-* 列,占据母...

网友评论

      本文标题:快速开发经验汇总小结(洪)

      本文链接:https://www.haomeiwen.com/subject/flpfsxtx.html