1. app 状态栏 黑色变成白色
参考链接:https://www.jianshu.com/p/6653fdc50ad3
//全局状态栏 白色 AppDelegate -> didFinishLaunchingWithOptions
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
2. pch 文件引入的正确姿势
参考链接:https://www.jianshu.com/p/95ea7ad663a6
3. 色值转换工具类#fffff -> UIColor
参考链接:https://www.jianshu.com/p/700c7c7cfe9d
我贴出工具类代码。以及在pch中定义代码
+ (UIColor *)GetColor:(NSString *)pColor alpha:(CGFloat) dAlpha
{
NSString* pStr = [[pColor stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
if ([pStr length] < 6) {
return [UIColor clearColor];
}
if ([pStr hasPrefix:@"0X"])
pStr = [pStr substringFromIndex:2];
if ([pStr hasPrefix:@"#"])
pStr = [pStr substringFromIndex:1];
if ([pStr length] != 6)
return [UIColor clearColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
//r
NSString *rString = [pStr substringWithRange:range];
//g
range.location = 2;
NSString *gString = [pStr substringWithRange:range];
//b
range.location = 4;
NSString *bString = [pStr substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:dAlpha];
}
//定义主颜色
#define main_color [ColorUtil GetColor:@"#42b5e1" alpha:1]
//方法使用
view.backgroundColor = main_color;
4. 全局屏幕宽高 与 状态栏高度 包含iphoneX 文件定义
//竖屏幕宽高
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
//设备型号
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6PlusScale ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
//导航栏
#define StatusBarHeight (iPhoneX ? 44.f : 20.f)
#define StatusBarAndNavigationBarHeight (iPhoneX ? 88.f : 64.f)
#define TabbarHeight (iPhoneX ? (49.f + 34.f) : (49.f))
#define BottomSafeAreaHeight (iPhoneX ? (34.f) : (0.f))
5. 继续造
参考链接:[https://www.jianshu.com/p/700c7c7cfe9d]
5. 继续造
参考链接:[https://www.jianshu.com/p/700c7c7cfe9d]
5. 继续造
参考链接:[https://www.jianshu.com/p/700c7c7cfe9d]
5. 继续造
参考链接:[https://www.jianshu.com/p/700c7c7cfe9d]
5. 继续造
参考链接:[https://www.jianshu.com/p/700c7c7cfe9d]
一级标题
二级标题
五级标题
- 列表第一项
- 列表第二项
- 有序列表第一项
- 有序列表第二项
标题
[图片上传失败...(image-1f4d57-1565245148222)]
斜体
粗体
引用段落
代码块