修复 ohmyzsh 的权限问题
Feb 16, 2021
安装了 OhMyZSH 和 Homebrew,打开终端后就会提示目录的权限不安全: 解决方法是重新设置目录的权限: chmod 755 /usr/local/share/zsh chmod 755 /usr/local/share/zsh/site-functions
iOS:禁用快捷指令的通知
Feb 09, 2021
进入系统设置,打开“屏幕使用时间”: 点击“查看所有活动” 滑动到最下面的“通知”分类,找到“快捷指令”,点击进入通知设置页面
网页排版:精确控制文字行高和间距
Feb 06, 2021
单行高度 一行文字的高度等于 font-size 乘以 line-height font-size: 14px, line-height: 1 当行高设置为 1 时,行高度是: 14 * 1 = 14px font-size: 14px, line-height: 1.5 调整到 1.5 时,行高度是: 14 * 1.5 = 21px 文字行内间距 文字在一行里的上下间距等于 font-size * (line-height - 1) * 0.5 …
iOS Simulators
Feb 02, 2021
iOS Simulators How to install Download iOS simulator dmg Copy to ~/Library/Caches/com.apple.dt.Xcode/Downloads/ Click download button in Xcode Components Simulators iOS 14.3 Simulator iOS 14.2 Simulator iOS 14.1 Simulator iOS 14.0 Simulator iOS 13.7 Simulator iOS 13.6 Simulator iOS 13.5 Simulator iOS 13.4 Simulator iOS 13.3 Simulator iOS 13.2 Simulator iOS 13.1 Simulator iOS 13.0 Simulator iOS 12.4 Simulator …
优雅的使用 Iconfont
Jan 11, 2021
Iconfont 就是把矢量图作为字体,可以很方便的在 App 里显示图标。拥有体积小加载速度快的优点。 推荐两个生成 Iconfont 的网站: 国外的 fontello 国内的 iconfont Fontello 没有自己的资源库,网站提供的素材是第三方的,基本上来自于 Fontelico 和 Font Awesome 。 …
xcrun 使用说明
Dec 03, 2020
xcrun 是 Xcode 的工具链的一部分,一般用来配置编译环境,在跨平台的编译配置上非常有用。 内置的帮助说明非常简洁: Usage: xcrun [options] <tool name> ... arguments ... Find and execute the named command line tool from the active developer directory. The active developer directory can be set using `xcode-select`, or via the DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual pages for more information. Options: -h, --help show this help message and exit --version show the xcrun version -v, --verbose show verbose logging output --sdk <sdk name> find the tool for the given SDK name --toolchain <name> find the tool for the given toolchain -l, --log show commands to be executed (with --run) -f, --find only find and print the tool path -r, --run find and execute the tool (the default behavior) -n, --no-cache do not use the lookup cache -k, --kill-cache invalidate all existing cache entries --show-sdk-path show selected SDK install path --show-sdk-version show selected SDK version --show-sdk-build-version show selected SDK build version --show-sdk-platform-path show selected SDK platform path --show-sdk-platform-version show selected SDK platform version 自动配置 sysroot 编译的时候需要指定 -sysroot=/root/path/to/sdk,include 和 lib 就基于 sysroot 指定的目录里进行查找,如果是在 macOS 上编译 iOS 程序,sysroot 就指向 iOS sdk 的目录。 …
macOS 上开启 VIM 的语法高亮功能
Nov 16, 2020
macOS 自带的 VIM 默认情况下是没有语法高亮的,编辑文件的时候白茫茫一片,体验非常不好。 手动开启语法高亮,打开终端 Terminal.app: vim ~/.vimrc 加入以下内容: syntax on 保存,再打开 VIM 就有语法高亮了。 …
恢复 Xcode 默认设置
Oct 15, 2020
一条命令就可以恢复 Xcode 的默认设置: defaults delete com.apple.dt.Xcode
Swift 里的 dispatch_once 替代方案
Sep 27, 2020
ObjC 里的 dispatch_once 使用起来很方便,但是 Swift 里废弃使用这个方法了,原因是鼓励大家使用 static let 。 …
拉取 Github 上的 Pull Request 代码到本地分支
Sep 19, 2020
如果在 GitHub 上看到一个好的 PR,作者又没有 Merge ,这个时候比较好的办法是合并到自己的 Fork 里。 …