pEpForiOS/UI/EmailDisplay/MessageCell.swift
author igor <igor@pep-project.org>
Tue, 17 Jan 2017 13:22:16 +0100
changeset 1438 a95b5815208d
parent 1361 a9a21279c74e
child 1943 213d041dc182
permissions -rw-r--r--
IOS-399 Finished
yves@1360
     1
//
yves@1360
     2
//  MessageCell.swift
yves@1360
     3
//
yves@1360
     4
//  Created by Yves Landert on 16.12.16.
yves@1360
     5
//  Copyright © 2016 appculture AG. All rights reserved.
yves@1360
     6
//
yves@1360
     7
yves@1360
     8
import UIKit
yves@1361
     9
import MessageModel
yves@1361
    10
yves@1361
    11
public protocol MessageCellDelegate: class {}
yves@1361
    12
yves@1361
    13
public protocol MessageContentCellDelegate: MessageCellDelegate {
yves@1361
    14
    
yves@1361
    15
    func cellDidUpdateHeight(_ with: CGFloat)
yves@1361
    16
}
yves@1361
    17
yves@1360
    18
yves@1360
    19
open class MessageCell: UITableViewCell {
yves@1360
    20
    
yves@1360
    21
    @IBOutlet weak public var titleLabel: UILabel?
yves@1360
    22
    @IBOutlet weak public var valueLabel: UILabel?
yves@1360
    23
    
yves@1361
    24
    open weak var delegate: MessageCellDelegate?
yves@1361
    25
    
yves@1360
    26
    public var fieldModel: ComposeFieldModel?
yves@1361
    27
    public var message: Message?
yves@1360
    28
    public var isExpanded = false
yves@1360
    29
    
yves@1360
    30
    override open func awakeFromNib() {
yves@1360
    31
        super.awakeFromNib()
yves@1360
    32
        selectionStyle = .none
yves@1360
    33
    }
yves@1360
    34
    
yves@1361
    35
    public func updateCell(_ model: ComposeFieldModel, _ message: Message) {
yves@1360
    36
        fieldModel = model
yves@1360
    37
        
yves@1360
    38
        if titleLabel != nil {
yves@1360
    39
            titleLabel?.text = fieldModel?.title
yves@1360
    40
        }
yves@1360
    41
    }
yves@1360
    42
}