美文网首页
ios 常用宏定义

ios 常用宏定义

作者: 星9星 | 来源:发表于2018-09-30 16:42 被阅读0次

pch 文件路径 build settings 搜索Prifixheader

$(SRCROOT)/黄色的文件夹名/黄色文件夹名/一层一层直到PCH文件名.pch

!!!  文件层要统一 工程里的文件夹包含关系要和Finder 里的一致

常用宏定义


颜色

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

设施控件圆角

#definekViewRadius(View,Radius)\\[View.layer setCornerRadius:(Radius)];\[View.layer setMasksToBounds:YES]

设施圆角  边框线宽度 颜色

#definekViewBorderRadius(View,Radius,Width,Color)\\[View.layer setCornerRadius:(Radius)];\[View.layer setMasksToBounds:YES];\[View.layer setBorderWidth:(Width)];\[View.layer setBorderColor:[Color CGColor]]

归档

#definekUserDefaults [NSUserDefaults standardUserDefaults]

屏幕长宽

#definekScreenWidth[UIScreen mainScreen].bounds.size.width#definekScreenHeight[UIScreen mainScreen].bounds.size.height

通知

#definekNoteCenter [NSNotificationCenter defaultCenter]

// 弱引用

#definekWeakSelf __weak typeof(self) weakSelf = self

/*Dubug相关/

#ifdefDEBUG#defineNSLog(...) NSLog(__VA_ARGS__)#definedebugMethod() NSLog(@"%s", __func__)#else#defineNSLog(...)#definedebugMethod()#endif#ifdefDEBUG#defineWSLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )//分别是方法地址,文件名,在文件的第几行,自定义输出内容#else#define**Log( s, ... )#endif

//不同屏幕尺寸字体适配#definekScreenWidthRatio  (UIScreen.mainScreen.bounds.size.width / 375.0)#definekScreenHeightRatio (UIScreen.mainScreen.bounds.size.height / 667.0)#defineAdaptedWidth(x)  ceilf((x) * kScreenWidthRatio)#defineAdaptedHeight(x) ceilf((x) * kScreenHeightRatio)#defineAdaptedFontSize(R)    [UIFont systemFontOfSize:AdaptedWidth(R)]

相关文章

  • iOS常用宏定义

    打印日志的几种写法 推荐文章iOS 日常工作之常用宏定义大全iOS常用宏定义 结束语 到这里就结束了,如若不懂的话...

  • iOS-常用宏定义

    [转自:iOS常用宏定义][http://www.cocoachina.com/ios/20161207/1831...

  • iOS 常用宏定义

    iOS 开发中使用一些常用宏定义可以大大提高开发效率,提高代码的重用性.以下是一些常用的宏定义: 像这些宏定义,在...

  • IOS NSLog宏定义

    IOS NSLog宏定义 标签(空格分隔): IOS IOS NSLog宏定义 宏定义NSLog方法,不用加";"...

  • iOS常用宏定义

    1.UI元素 //NavBar高度#defineNAVIGATIONBAR_HEIGHT 44//StatusBa...

  • iOS常用宏定义

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

  • iOS常用宏定义

    字符串是否为空 数组是否为空 字典是否为空 是否是空对象 获取屏幕宽度与高度 ( " \ ":连接行标志,连接上下...

  • iOS常用宏定义

  • iOS常用宏定义

    #ifndef MacroDefinition_h #define MacroDefinition_h //---...

  • iOS常用宏定义

    整理 //常用宏定义 //是否为V以上系统 #define IOS(V) [[[UIDevice currentD...

网友评论

      本文标题:ios 常用宏定义

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