Files
Yep/Yep/Views/TextViews/ChatTextView.swift
T

33 lines
937 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// ChatTextView.swift
// Yep
//
// Created by NIX on 15/6/26.
// Copyright (c) 2015年 Catch Inc. All rights reserved.
//
import UIKit
class ChatTextView: UITextView {
override func canBecomeFirstResponder() -> Bool {
return false
}
override func addGestureRecognizer(gestureRecognizer: UIGestureRecognizer) {
// iOS 9 以上,强制不添加文字选择长按手势,免去触发选择文字
// 共有四种长按手势,iOS 9 正式版里分别加了两次:0.1 Reveal0.12 tap link0.5 selection 0.75 press link
if isOperatingSystemAtLeastMajorVersion(9) {
if let longPressGestureRecognizer = gestureRecognizer as? UILongPressGestureRecognizer {
if longPressGestureRecognizer.minimumPressDuration == 0.5 {
return
}
}
}
super.addGestureRecognizer(gestureRecognizer)
}
}