iOS开发小记

字体拉伸

NSString *fontName = @"PingFangSC-Regular";
CGFloat scale = 2.0;
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformScale(transform, 1.0, scale);
UIFontDescriptor *descriptor = [UIFontDescriptor fontDescriptorWithName:fontName matrix:transform];

clang重写.m文件为.cpp文件

clang -rewrite-objc xxx.m
clang -rewrite-objc -fobjc-arc -fobjc-runtime=macosx-10.14 xxx.m

忽略警告

  • 忽略单个警告
#pragma clang diagnostic push
#pragma clang diagnostic ignored "相关命令"
    // 忽略警告的代码          
#pragma clang diagnostic pop

其中相关命令通过右击对应的警告,Reveal in Log找到。

  • 忽略某个类型的所有警告
    Build Settings -> Other Warning Flags 添加对应 相关命令, 如:
-Wformat -> -Wno-format
-Wunused-variable -> -Wno-unused-variable
-Wundeclared-selector -> -Wno-undeclared-selector

你可能感兴趣的:(iOS开发小记)