mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-24 20:26:02 +10:00
33 lines
937 B
Swift
33 lines
937 B
Swift
//
|
||
// 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 Reveal,0.12 tap link,0.5 selection, 0.75 press link
|
||
if isOperatingSystemAtLeastMajorVersion(9) {
|
||
if let longPressGestureRecognizer = gestureRecognizer as? UILongPressGestureRecognizer {
|
||
if longPressGestureRecognizer.minimumPressDuration == 0.5 {
|
||
return
|
||
}
|
||
}
|
||
}
|
||
|
||
super.addGestureRecognizer(gestureRecognizer)
|
||
}
|
||
}
|
||
|