日常随记2021-11-10

2022-02-27  本文已影响0人  桃色三岁

最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动

原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:

pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
更新本地仓库 pod repo update

xcode连接不上设备

sudo pkill usbmuxd

显示或隐藏文件夹

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

ios15 全局设置 导航栏透明问题

if #available(iOS 15.0, *) {
     let app = UINavigationBarAppearance()
     app.configureWithOpaqueBackground()  // 重置背景和阴影颜色
     app.titleTextAttributes = [
           NSAttributedString.Key.font: UIFont.systemFont(ofSize: 18),
           NSAttributedString.Key.foregroundColor: UIColor.white
     ]
     app.backgroundColor = UIColor.init(hexString: "#2C81EC")  // 设置导航栏背景色
     app.shadowColor = .clear
     UINavigationBar.appearance().scrollEdgeAppearance = app  // 带scroll滑动的页面
     UINavigationBar.appearance().standardAppearance = app // 常规页面。描述导航栏以标准高度
}
if #available(iOS 15.0, *) {
       let app = UINavigationBarAppearance()
       app.configureWithOpaqueBackground()  // 重置背景和阴影颜色
       app.backgroundEffect = nil
       app.titleTextAttributes = [
               NSAttributedString.Key.font: UIFont.systemFont(ofSize: 18),
               NSAttributedString.Key.foregroundColor: UIColor.white
       ]
       app.backgroundColor = .clear // 设置导航栏背景色
       app.shadowColor = nil
       UINavigationBar.appearance().scrollEdgeAppearance = nil  // 带scroll滑动的页面
       UINavigationBar.appearance().standardAppearance = app // 常规页面。描述导航栏以标准高度
 }

UILabel显示富文本标签(解析成html的富文本)

+ (NSAttributedString *)nxm_mutableAttrHtmlStringFrom:(NSString *)content {
    content = [NSString stringWithFormat:@"<html><meta content=\"width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=0; \" name=\"viewport\" /><body style=\"overflow-wrap:break-word;word-break:break-all;white-space: normal; font-size:12px; color:#A4A4A4; \">%@</body></html>", content];
    NSAttributedString *mutableAttr=  [[NSAttributedString alloc] initWithData:[content dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute:@(NSUTF8StringEncoding)} documentAttributes:nil error:nil];
    return mutableAttr;
}
上一篇 下一篇

猜你喜欢

热点阅读