Files
libr-ios/librx/CustomTableCell.swift
2015-11-23 22:50:54 +08:00

61 lines
1.7 KiB
Swift

//
// CustomTableCell.swift
// librx
//
// Created by Yunlong Zheng on 15/8/3.
// Copyright (c) 2015年 librx. All rights reserved.
//
import UIKit
protocol StoryTableNavigationDelegate {
func navigationTo(userId: Int)
}
class CustomTableCell: UITableViewCell {
@IBOutlet weak var cellContentView: UIView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var readNumLabel: UILabel!
@IBOutlet weak var likeNumLabel: UILabel!
@IBOutlet weak var thumbnilImageView: UIImageView!
@IBOutlet weak var timeDiffLabel: UILabel!
@IBOutlet weak var shareNameLabel: UILabel!
@IBOutlet weak var summary: UILabel!
@IBOutlet weak var avatarImageView: UIImageView!
@IBOutlet weak var nameButton: UIButton!
@IBOutlet weak var pageMarkLabel: UILabel!
var delegate: StoryTableNavigationDelegate?
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
func clickButton(button:UIButton) {
if let _ = delegate {
delegate?.navigationTo(button.tag)
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.nameButton.addTarget(self, action: "clickButton:", forControlEvents: UIControlEvents.TouchUpInside)
cellContentView.layer.cornerRadius = 4
cellContentView.clipsToBounds = true
cellContentView.layer.borderWidth = 1
cellContentView.layer.borderColor = UIColor(hexString: "#f4f4f4")?.CGColor
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}