Some optimizations for TextBubbleView (#144)

This commit is contained in:
Diego Sánchez 2016-06-01 13:43:37 +01:00
parent 592c8ee142
commit d87fe40c90
2 changed files with 23 additions and 3 deletions

View File

@ -287,4 +287,24 @@ private final class ChatMessageTextView: UITextView {
override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool {
return false
}
override var selectedRange: NSRange {
get {
return NSRange(location: 0, length: 0)
}
set {
// Part of the heaviest stack trace when scrolling (when updating text)
// See https://github.com/badoo/Chatto/pull/144
}
}
override var contentOffset: CGPoint {
get {
return .zero
}
set {
// Part of the heaviest stack trace when scrolling (when bounds are set)
// See https://github.com/badoo/Chatto/pull/144
}
}
}

View File

@ -146,17 +146,17 @@ public class TextMessageCollectionViewCellDefaultStyle: TextMessageCollectionVie
let tailKey = showsTail ? "tail" : "notail"
let statusKey = self.statusKey(status)
let highlightedKey = isSelected ? "highlighted" : "normal"
let key = "\(directionKey)_\(tailKey)_\(statusKey)_\(highlightedKey)"
let key = directionKey + "_" + tailKey + "_" + statusKey + "_" + highlightedKey
return key
}
private func templateKey(isIncoming isIncoming: Bool, showsTail: Bool) -> String {
let directionKey = isIncoming ? "incoming" : "outgoing"
let tailKey = showsTail ? "tail" : "notail"
return "\(directionKey)_\(tailKey)"
return directionKey + "_" + tailKey
}
private func statusKey(status: MessageViewModelStatus) -> NSString {
private func statusKey(status: MessageViewModelStatus) -> String {
switch status {
case .Success:
return "ok"