Skip to content

Instantly share code, notes, and snippets.

# included:
excluded:
- Pods
- R.generated.swift
# analyzer_rules:
disabled_rules:
- function_body_length
@dklinzh
dklinzh / UIImage+Draw.m
Created July 8, 2019 03:10
UIImage图形扩展
@implementation UIImage (Draw)
//画一个直角矩形图片
+ (UIImage *)drawRectImageWithColor:(UIColor *)color size:(CGSize)size {
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
@dklinzh
dklinzh / Overview.md
Created May 15, 2019 05:58 — forked from NSProgrammer/Overview.md
Comparing modern vs legacy graphics context rendering on iOS

legacy = UIGraphicsBeginImageContextWithOptions + UIGraphicsEndImageContext

modern = UIGraphicsImageRendererFormat + UIGraphicsImageRenderer

Take aways:

  • "modern" w/ prefersExtendedRange = NO
    • basically the same perf as "legacy"
    • probably a good idea to adopt since optimizations will likely be in "modern" first
  • "modern" w/ prefersExtendedRange = YES
@dklinzh
dklinzh / Find non-localized strings.md
Created May 8, 2019 01:58
Find non-localized Chinese strings in Xcode. (在Xcode中查找未国际化中文字符串)

Find non-localized String

Xcode Find navigator > Find > Regular Expression, enter a query condition below:

For Chinese

  • Swift
= "[^"]*[\u4E00-\u9FA5]+[^"\n]*?"
@dklinzh
dklinzh / .zshrc
Last active April 30, 2019 09:15
Quick guide of ZSH usage. (ZSH快速使用指南)
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
source ~/.bash_profile
# Path to your oh-my-zsh installation.
export ZSH="/Users/dklinzh/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
@dklinzh
dklinzh / Good IOS RTSP Player.md
Created October 20, 2016 06:14 — forked from oc2pcoj/Good IOS RTSP Player.md
iOS RTSP player for IP video cameras