Skip to content

Instantly share code, notes, and snippets.

@usagimaru
Created May 9, 2017 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usagimaru/911ef08ad366bab79f30366f587d8d6e to your computer and use it in GitHub Desktop.
Save usagimaru/911ef08ad366bab79f30366f587d8d6e to your computer and use it in GitHub Desktop.
UIScrollView extension.
import UIKit
extension UIScrollView {
/// ms 後にスクロールインジケーターを表示
func flashScrollIndicators(afterIn milliseconds: Int = 500) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .milliseconds(milliseconds)) {[weak self] in
self?.flashScrollIndicators()
}
}
/// 慣性スクロールを停止
func stopDeceleration() {
setContentOffset(contentOffset, animated: false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment