mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-20 02:06:26 +10:00
longPress on ChatRightTextCell's bubble
This commit is contained in:
@@ -58,11 +58,8 @@ class ChatLeftTextCell: UICollectionViewCell {
|
||||
}
|
||||
|
||||
func handleLongPress(longPress: UILongPressGestureRecognizer) {
|
||||
|
||||
if longPress.state == .Began {
|
||||
|
||||
if let view = longPress.view, superview = view.superview {
|
||||
|
||||
view.becomeFirstResponder()
|
||||
|
||||
let menu = UIMenuController.sharedMenuController()
|
||||
|
||||
@@ -42,6 +42,9 @@ class ChatRightTextCell: ChatRightBaseCell {
|
||||
NSUnderlineStyleAttributeName: NSNumber(integer: NSUnderlineStyle.StyleSingle.rawValue),
|
||||
]
|
||||
|
||||
let longPress = UILongPressGestureRecognizer(target: self, action: "handleLongPress:")
|
||||
textContentTextView.addGestureRecognizer(longPress)
|
||||
|
||||
textContentTextViewTrailingConstraint.constant = YepConfig.chatCellGapBetweenTextContentLabelAndAvatar()
|
||||
textContentTextViewLeadingConstraint.constant = YepConfig.chatTextGapBetweenWallAndContentLabel()
|
||||
|
||||
@@ -53,6 +56,18 @@ class ChatRightTextCell: ChatRightBaseCell {
|
||||
bubbleBodyImageView.addGestureRecognizer(tap)
|
||||
}
|
||||
|
||||
func handleLongPress(longPress: UILongPressGestureRecognizer) {
|
||||
if longPress.state == .Began {
|
||||
if let view = longPress.view, superview = view.superview {
|
||||
view.becomeFirstResponder()
|
||||
|
||||
let menu = UIMenuController.sharedMenuController()
|
||||
menu.setTargetRect(view.frame, inView: superview)
|
||||
menu.setMenuVisible(true, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func tapMediaView() {
|
||||
mediaTapAction?()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user