项目介绍:
TimelineTableViewCell
TimelineTableViewCell由UITableViewCell实现了一个简单的时间线视图(Swift3.0)。TimelineTableViewCell UI的设计灵感来自 istimeline 。
环境需求
-
iOS 8.0 or higher
-
Swift 3.0
安装过程
-
CocoaPods:
pod "TimelineTableViewCell"
-
Swift Package Manager:
.Package(url: "https://github.com/kf99916/TimelineTableViewCell.git", majorVersion: 1.0)
使用步骤
Import 导入头文件
import TimelineTableViewCell
集成代码
Register Nib
let bundle = Bundle(for: TimelineTableViewCell.self)
let nibUrl = bundle.url(forResource: "TimelineTableViewCell", withExtension: "bundle")
let timelineTableViewCellNib = UINib(nibName: "TimelineTableViewCell",
bundle: Bundle(url: nibUrl!)!)
tableView.register(timelineTableViewCellNib, forCellReuseIdentifier: "TimelineTableViewCell")
Dequeue
let cell = tableView.dequeueReusableCell(withIdentifier: "TimelineTableViewCell",
for: indexPath) as! TimelineTableViewCell
// Configure TimelineTableViewCell...
时间轴上点的设置
时间轴上的点(point)是由timelinepoint对象表示。
var diameter: CGFloat
the diameter of a point in the line (default 6.0
) var lineWidth: CGFloat
the thickness of the point (default 2.0
) var color: UIColor
the color of each point in the line (defalut UIColor.black
) var isFilled: Bool
fills the point in the line (default: false
)
初始化
TimelinePoint(diameter: CGFloat, lineWidth: CGFloat, color: UIColor, filled: Bool)
TimelinePoint(diameter: CGFloat, color: UIColor, filled: Bool)
TimelinePoint(color: UIColor, filled: Bool)
TimelinePoint()
时间轴
The line in the cell is represented by a Timeline object and is divided by the point as the front line and the backline. var width: CGFloat
the thickness of the line (default 2.0
) var frontColor: UIColor
the color of the front line (defalut UIColor.black
) var backColor: UIColor
the color of the back line (defalut UIColor.black
)
Initializers
Timeline(width: CGFloat, frontColor: UIColor, backColor: UIColor)
Timeline(frontColor: UIColor, backColor: UIColor)
Timeline()
TimelineTableViewCell
The cell is represented by a TimelineTableViewCell object. titleLabel: UILabel!
the title in the bubble descriptionLabel: UILabel!
the description lineInfoLabel: UILabel!
the information about line thumbnailImageView: thumbnailImageView!
the thumbnail var bubbleRadius: CGFloat
the radius of the bubble corners (default 2.0
) var bubbleColor: UIColor
the color of every bubble (default .init(red: 0.75, green: 0.75, blue: 0.75, alpha: 1.0)
)
Author
Zheng-Xiang Ke, kf99916@gmail.com