mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-26 13:16:10 +10:00
new ChatLeftLocationCell
This commit is contained in:
@@ -10,17 +10,29 @@ import UIKit
|
||||
|
||||
class ChatLeftLocationCell: ChatBaseCell {
|
||||
|
||||
@IBOutlet weak var mapImageView: UIImageView!
|
||||
@IBOutlet weak var locationNameLabel: UILabel!
|
||||
@IBOutlet weak var borderImageView: UIImageView!
|
||||
lazy var mapImageView: UIImageView = {
|
||||
let imageView = UIImageView()
|
||||
imageView.contentMode = .ScaleAspectFill
|
||||
imageView.tintColor = UIColor.leftBubbleTintColor()
|
||||
return imageView
|
||||
}()
|
||||
|
||||
lazy var locationNameLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.textColor = UIColor.whiteColor()
|
||||
return label
|
||||
}()
|
||||
|
||||
lazy var borderImageView: UIImageView = {
|
||||
let imageView = UIImageView(image: UIImage(named: "left_tail_image_bubble_border"))
|
||||
return imageView
|
||||
}()
|
||||
|
||||
typealias MediaTapAction = () -> Void
|
||||
var mediaTapAction: MediaTapAction?
|
||||
|
||||
func makeUI() {
|
||||
|
||||
//let fullWidth = UIScreen.mainScreen().bounds.width
|
||||
|
||||
let halfAvatarSize = YepConfig.chatCellAvatarSize() / 2
|
||||
|
||||
var topOffset: CGFloat = 0
|
||||
@@ -40,30 +52,34 @@ class ChatLeftLocationCell: ChatBaseCell {
|
||||
let locationNameLabelHeight = YepConfig.ChatCell.locationNameLabelHeight
|
||||
|
||||
locationNameLabel.frame = CGRect(x: CGRectGetMinX(mapImageView.frame) + 20 + 7, y: CGRectGetMaxY(mapImageView.frame) - locationNameLabelHeight, width: 192 - 20 * 2 - 7, height: locationNameLabelHeight)
|
||||
//locationNameLabel.backgroundColor = UIColor.redColor().colorWithAlphaComponent(0.1)
|
||||
|
||||
configureNameLabel()
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
contentView.addSubview(mapImageView)
|
||||
contentView.addSubview(locationNameLabel)
|
||||
contentView.addSubview(borderImageView)
|
||||
|
||||
UIView.performWithoutAnimation { [weak self] in
|
||||
self?.makeUI()
|
||||
}
|
||||
|
||||
mapImageView.tintColor = UIColor.leftBubbleTintColor()
|
||||
locationNameLabel.textColor = UIColor.whiteColor()
|
||||
|
||||
mapImageView.userInteractionEnabled = true
|
||||
let tap = UITapGestureRecognizer(target: self, action: "tapMediaView")
|
||||
mapImageView.addGestureRecognizer(tap)
|
||||
|
||||
|
||||
prepareForMenuAction = { otherGesturesEnabled in
|
||||
tap.enabled = otherGesturesEnabled
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func tapMediaView() {
|
||||
mediaTapAction?()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user