Align separator start with the text on the timeline
This commit is contained in:
parent
dcb65f6454
commit
2724dbf4f2
@ -53,8 +53,9 @@ struct MasterTimelineCellLayout {
|
|||||||
let starRect: CGRect
|
let starRect: CGRect
|
||||||
let avatarImageRect: CGRect
|
let avatarImageRect: CGRect
|
||||||
let paddingBottom: CGFloat
|
let paddingBottom: CGFloat
|
||||||
|
let separatorInsets: UIEdgeInsets
|
||||||
|
|
||||||
init(width: CGFloat, height: CGFloat, feedNameRect: CGRect, dateRect: CGRect, titleRect: CGRect, numberOfLinesForTitle: Int, summaryRect: CGRect, textRect: CGRect, unreadIndicatorRect: CGRect, starRect: CGRect, avatarImageRect: CGRect, paddingBottom: CGFloat) {
|
init(width: CGFloat, height: CGFloat, feedNameRect: CGRect, dateRect: CGRect, titleRect: CGRect, numberOfLinesForTitle: Int, summaryRect: CGRect, textRect: CGRect, unreadIndicatorRect: CGRect, starRect: CGRect, avatarImageRect: CGRect, paddingBottom: CGFloat, separatorInsets: UIEdgeInsets) {
|
||||||
|
|
||||||
self.width = width - MasterTimelineCellLayout.chevronWidth
|
self.width = width - MasterTimelineCellLayout.chevronWidth
|
||||||
self.feedNameRect = feedNameRect
|
self.feedNameRect = feedNameRect
|
||||||
@ -67,6 +68,7 @@ struct MasterTimelineCellLayout {
|
|||||||
self.starRect = starRect
|
self.starRect = starRect
|
||||||
self.avatarImageRect = avatarImageRect
|
self.avatarImageRect = avatarImageRect
|
||||||
self.paddingBottom = paddingBottom
|
self.paddingBottom = paddingBottom
|
||||||
|
self.separatorInsets = separatorInsets
|
||||||
|
|
||||||
if height > 0.1 {
|
if height > 0.1 {
|
||||||
self.height = height
|
self.height = height
|
||||||
@ -108,7 +110,9 @@ struct MasterTimelineCellLayout {
|
|||||||
|
|
||||||
let paddingBottom = MasterTimelineCellLayout.cellPadding.bottom
|
let paddingBottom = MasterTimelineCellLayout.cellPadding.bottom
|
||||||
|
|
||||||
self.init(width: width, height: height, feedNameRect: feedNameRect, dateRect: dateRect, titleRect: titleRect, numberOfLinesForTitle: numberOfLinesForTitle, summaryRect: summaryRect, textRect: textRect, unreadIndicatorRect: unreadIndicatorRect, starRect: starRect, avatarImageRect: avatarImageRect, paddingBottom: paddingBottom)
|
let separatorInsets = UIEdgeInsets(top: 0, left: unreadIndicatorRect.maxX + MasterTimelineCellLayout.unreadCircleMarginRight, bottom: 0, right: 0)
|
||||||
|
|
||||||
|
self.init(width: width, height: height, feedNameRect: feedNameRect, dateRect: dateRect, titleRect: titleRect, numberOfLinesForTitle: numberOfLinesForTitle, summaryRect: summaryRect, textRect: textRect, unreadIndicatorRect: unreadIndicatorRect, starRect: starRect, avatarImageRect: avatarImageRect, paddingBottom: paddingBottom, separatorInsets: separatorInsets)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,17 +51,19 @@ class MasterTimelineTableViewCell: UITableViewCell {
|
|||||||
|
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
let layoutRects = updatedLayoutRects()
|
let layout = updatedLayout()
|
||||||
|
|
||||||
setFrame(for: titleView, rect: layoutRects.titleRect)
|
setFrame(for: titleView, rect: layout.titleRect)
|
||||||
setFrame(for: summaryView, rect: layoutRects.summaryRect)
|
setFrame(for: summaryView, rect: layout.summaryRect)
|
||||||
setFrame(for: textView, rect: layoutRects.textRect)
|
setFrame(for: textView, rect: layout.textRect)
|
||||||
|
|
||||||
dateView.setFrameIfNotEqual(layoutRects.dateRect)
|
dateView.setFrameIfNotEqual(layout.dateRect)
|
||||||
unreadIndicatorView.setFrameIfNotEqual(layoutRects.unreadIndicatorRect)
|
unreadIndicatorView.setFrameIfNotEqual(layout.unreadIndicatorRect)
|
||||||
feedNameView.setFrameIfNotEqual(layoutRects.feedNameRect)
|
feedNameView.setFrameIfNotEqual(layout.feedNameRect)
|
||||||
avatarImageView.setFrameIfNotEqual(layoutRects.avatarImageRect)
|
avatarImageView.setFrameIfNotEqual(layout.avatarImageRect)
|
||||||
starView.setFrameIfNotEqual(layoutRects.starRect)
|
starView.setFrameIfNotEqual(layout.starRect)
|
||||||
|
|
||||||
|
separatorInset = layout.separatorInsets
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ private extension MasterTimelineTableViewCell {
|
|||||||
accessoryView = UIImageView(image: AppAssets.chevronRightImage)
|
accessoryView = UIImageView(image: AppAssets.chevronRightImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatedLayoutRects() -> MasterTimelineCellLayout {
|
func updatedLayout() -> MasterTimelineCellLayout {
|
||||||
|
|
||||||
return MasterTimelineCellLayout(width: bounds.width, height: bounds.height, cellData: cellData, hasAvatar: avatarImageView.image != nil)
|
return MasterTimelineCellLayout(width: bounds.width, height: bounds.height, cellData: cellData, hasAvatar: avatarImageView.image != nil)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user