test FeedURLCell

This commit is contained in:
nixzhu
2016-01-14 16:21:15 +08:00
parent ed9b15cfb7
commit 079f17f7f5
4 changed files with 16 additions and 4 deletions
@@ -127,6 +127,7 @@ class FeedsViewController: BaseViewController {
private let feedDribbbleShotCellID = "FeedDribbbleShotCell"
private let feedVoiceCellID = "FeedVoiceCell"
private let feedLocationCellID = "FeedLocationCell"
private let feedURLCellID = "FeedURLCell"
private let loadMoreTableViewCellID = "LoadMoreTableViewCell"
private lazy var noFeedsFooterView: InfoView = InfoView(NSLocalizedString("No Feeds.", comment: ""))
@@ -315,6 +316,7 @@ class FeedsViewController: BaseViewController {
feedsTableView.registerClass(FeedDribbbleShotCell.self, forCellReuseIdentifier: feedDribbbleShotCellID)
feedsTableView.registerClass(FeedVoiceCell.self, forCellReuseIdentifier: feedVoiceCellID)
feedsTableView.registerClass(FeedLocationCell.self, forCellReuseIdentifier: feedLocationCellID)
feedsTableView.registerClass(FeedURLCell.self, forCellReuseIdentifier: feedURLCellID)
feedsTableView.registerNib(UINib(nibName: loadMoreTableViewCellID, bundle: nil), forCellReuseIdentifier: loadMoreTableViewCellID)
@@ -946,7 +948,8 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate {
switch feed.kind {
case .Text:
let cell = tableView.dequeueReusableCellWithIdentifier(feedBasicCellID) as! FeedBasicCell
//let cell = tableView.dequeueReusableCellWithIdentifier(feedBasicCellID) as! FeedBasicCell
let cell = tableView.dequeueReusableCellWithIdentifier(feedURLCellID) as! FeedURLCell
return cell
case .Image:
+2 -1
View File
@@ -125,7 +125,8 @@ struct FeedCellLayout {
switch feed.kind {
case .Text:
height = FeedBasicCell.heightOfFeed(feed)
//height = FeedBasicCell.heightOfFeed(feed)
height = FeedURLCell.heightOfFeed(feed)
case .Image:
if feed.imageAttachmentsCount == 1 {
+8 -2
View File
@@ -8,10 +8,12 @@
import UIKit
private let screenWidth: CGFloat = UIScreen.mainScreen().bounds.width
class FeedURLCell: FeedBasicCell {
lazy var feedURLContainerView: UIView = {
let view = UIView()
lazy var feedURLContainerView: FeedURLContainerView = {
let view = FeedURLContainerView()
return view
}()
@@ -44,6 +46,10 @@ class FeedURLCell: FeedBasicCell {
super.configureWithFeed(feed, layoutCache: (layout: layoutCache.layout, update: { newLayout in
_newLayout = newLayout
}), needShowSkill: needShowSkill)
let y = messageTextView.frame.origin.y + messageTextView.frame.height + 15
let height: CGFloat = leftBottomLabel.frame.origin.y - y - 15
feedURLContainerView.frame = CGRect(x: 65, y: y, width: screenWidth - 65 - 60, height: height)
}
}
@@ -38,6 +38,8 @@ class FeedURLContainerView: UIView {
private func makeUI() {
backgroundColor = UIColor.lightGrayColor()
addSubview(siteNameLabel)
addSubview(titleLabel)