Skip to content

Instantly share code, notes, and snippets.

View anddygon's full-sized avatar
🤒
Out sick

anddygon anddygon

🤒
Out sick
View GitHub Profile
建立一个symbol断点,symbol写UIViewAlertForUnsatisfiableConstraints。
断点action填写 expr -l objc++ -O -- [[UIWindow keyWindow] _autolayoutTrace]
expr -l Swift -- import UIKit
expr -l Swift -- unsafeBitCast(0x控件地址, to: UIView.self).backgroundColor = UIColor.red
@anddygon
anddygon / gist:a196088849fc6272ac3e68b46ec89969
Created July 19, 2019 09:21
NotificationServiceExtension 版本号引发的血案
遇到一个奇怪的问题,公司所有小伙伴的推送都能正常显示内容,只有一个手机内容只会显示body,各种查,找,猜,最后发现项目里NotificationServiceExtension设置的
版本比这台测试手机版本高,导致的。🤣🤣🤣
@anddygon
anddygon / .swift
Last active June 25, 2019 07:46
ScrollView停止滚动 检测
//停止滚动检测方式很多 这个方案不管是代码设置的滚动动画 还是 用户触摸事件的停止滚动 都能获取到 效率测试了下还可以
func scrollViewDidScroll(_ scrollView: UIScrollView) {
isScrolling = true
NSObject.cancelPreviousPerformRequests(withTarget: self)
self.perform(#selector(scrollViewDidEndScrollingAnimation(_:)), with: scrollView, afterDelay: 0.3)
}
func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
NSObject.cancelPreviousPerformRequests(withTarget: self)
@anddygon
anddygon / test.swift
Last active May 21, 2019 08:56
利用Extension“重载”原有实现
// 先了解下Module在iOS中的概念
// Module,中文译为「标准部件;模块」。iOS 中的 Module 类似于 Java 中的 Jar 包,也可以称作第三方库,或者框架(Framework)。
// 假设一个场景 A项目用cocoapods使用了B框架,这时候项目就2个module,A B,我们想修改B项目中一个公开方法的实现
// 方案一: fork自己任意修改,这样可以达到目的,但是一来费事,二来可能这么做不一定合理
// 方案二: 利用iOS访问控制,当我们在A module里面调用B里面的一个方法,系统会首先在当前Module里查找要调用方法所属类的extension里的同名方法,
// 这话有点绕,上代码吧
// A 中