Skip to content

Instantly share code, notes, and snippets.

View zhaozzq's full-sized avatar
😜
I may be slow to respond.

Zhao zhaozzq

😜
I may be slow to respond.
View GitHub Profile
@zhaozzq
zhaozzq / UIButton+VerticalLayout.m
Created August 17, 2018 02:31 — forked from lucaspang/UIButton+VerticalLayout.m
iOS UIButton center Image and Text Vertically
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
@end
@implementation UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding
func switchRootViewController(rootViewController: UIViewController, animated: Bool, completion: (() -> Void)?) {
if animated {
UIView.transitionWithView(window, duration: 0.5, options: .TransitionCrossDissolve, animations: {
let oldState: Bool = UIView.areAnimationsEnabled()
UIView.setAnimationsEnabled(false)
self.window!.rootViewController = rootViewController
UIView.setAnimationsEnabled(oldState)
}, completion: { (finished: Bool) -> () in
if completion {
completion!()
@zhaozzq
zhaozzq / 设置git代理.md
Last active January 26, 2024 10:53 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@zhaozzq
zhaozzq / ChineseTransliterator.swift
Created May 8, 2021 09:22
Transliterate Chinese between simplified and traditional (the wrong way).
import UIKit
struct ChineseTransliterator {
static func transliterate(text: String, sourceView: UIView) {
let textView = UITextView()
textView.isHidden = true
textView.text = text
textView.selectAll(nil)
sourceView.addSubview(textView)