update
This commit is contained in:
68
Pods/CocoaDebug/Sources/Logs/LogCell.swift
generated
Normal file
68
Pods/CocoaDebug/Sources/Logs/LogCell.swift
generated
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Example
|
||||
// man
|
||||
//
|
||||
// Created by man 11/11/2018.
|
||||
// Copyright © 2020 man. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class LogCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var labelContent: CustomTextView!
|
||||
@IBOutlet weak var viewTypeLogColor: UIView!
|
||||
|
||||
var model: _OCLogModel? {
|
||||
didSet {
|
||||
guard let model = model else { return }
|
||||
|
||||
labelContent.text = nil
|
||||
labelContent.text = model.str
|
||||
labelContent.attributedText = model.attr
|
||||
|
||||
labelContent.textContainer.lineBreakMode = NSLineBreakMode.byCharWrapping
|
||||
labelContent.textContainer.lineFragmentPadding = 0
|
||||
labelContent.textContainerInset = .zero
|
||||
labelContent.isUserInteractionEnabled = false
|
||||
|
||||
//tag
|
||||
if model.isTag == true {
|
||||
self.contentView.backgroundColor = "#007aff".hexColor
|
||||
} else {
|
||||
//isSelected
|
||||
if model.isSelected == true {
|
||||
self.contentView.backgroundColor = "#222222".hexColor
|
||||
} else {
|
||||
self.contentView.backgroundColor = .black
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CustomTextView : UITextView {
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)!
|
||||
self.inputView = UIView.init(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
|
||||
}
|
||||
|
||||
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
|
||||
if action == #selector(selectAll) {
|
||||
if let range = selectedTextRange, range.start == beginningOfDocument, range.end == endOfDocument {
|
||||
return false
|
||||
}
|
||||
return !text.isEmpty
|
||||
}
|
||||
else if action == #selector(paste(_:)) {
|
||||
return false
|
||||
}
|
||||
else if action == #selector(cut(_:)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return super.canPerformAction(action, withSender: sender)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user