|
@@ -16,7 +16,6 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
|
|
|
let disposeBag = DisposeBag()
|
|
|
|
|
|
-
|
|
|
deinit {
|
|
|
NXLLog("deinit")
|
|
|
webView.scrollView.removeObserver(self, forKeyPath: "contentSize")
|
|
@@ -34,6 +33,7 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
setupViews()
|
|
|
setupLayouts()
|
|
|
+ setupdata()
|
|
|
}
|
|
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
@@ -120,6 +120,17 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func setupdata() {
|
|
|
+ followButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ CommunityFollowUserViewModel.shared.follow(communityPostDetailModel: (self?.communityPostDetailModel)!, button: (self?.followButton)!)
|
|
|
+
|
|
|
+ }
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ }
|
|
|
+
|
|
|
private lazy var titleLabel: UILabel = {
|
|
|
let titleLabel = UILabel()
|
|
|
titleLabel.textColor = k262626Color
|
|
@@ -157,14 +168,6 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
followButton.masksToBounds = true
|
|
|
followButton.layer.borderWidth = 0.5
|
|
|
followButton.isHidden = true
|
|
|
- followButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- if UserModel.isTokenNil() {
|
|
|
- kAppDelegate.setLogin()
|
|
|
- }else {
|
|
|
- CommunityFollowUserViewModel.shared.follow(communityPostDetailModel: (self?.communityPostDetailModel)!, button: (self?.followButton)!)
|
|
|
-
|
|
|
- }
|
|
|
- }).disposed(by: disposeBag)
|
|
|
return followButton
|
|
|
}()
|
|
|
|
|
@@ -200,7 +203,6 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
}()
|
|
|
|
|
|
private lazy var collectionView: UICollectionView = {
|
|
|
- [unowned self] in
|
|
|
let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
|
|
|
collectionView.backgroundColor = kffffffColor
|
|
|
collectionView.delegate = self
|
|
@@ -212,8 +214,18 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
return collectionView
|
|
|
}()
|
|
|
|
|
|
- private lazy var collectionViewLayout: UICollectionViewLeftAlignedLayout = {
|
|
|
- let collectionViewLayout = UICollectionViewLeftAlignedLayout.init()
|
|
|
+// private lazy var collectionViewLayout: UICollectionViewLeftAlignedLayout = {
|
|
|
+// let collectionViewLayout = UICollectionViewLeftAlignedLayout.init()
|
|
|
+// collectionViewLayout.minimumLineSpacing = 10
|
|
|
+// collectionViewLayout.minimumInteritemSpacing = 10
|
|
|
+// collectionViewLayout.scrollDirection = UICollectionView.ScrollDirection.vertical
|
|
|
+// collectionViewLayout.estimatedItemSize = CGSize(width: ((kScreenWidth - 28) - 30)/4, height: 24)
|
|
|
+// collectionViewLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+// return collectionViewLayout
|
|
|
+// }()
|
|
|
+
|
|
|
+ private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
|
|
+ let collectionViewLayout = UICollectionViewFlowLayout()
|
|
|
collectionViewLayout.minimumLineSpacing = 10
|
|
|
collectionViewLayout.minimumInteritemSpacing = 10
|
|
|
collectionViewLayout.scrollDirection = UICollectionView.ScrollDirection.vertical
|
|
@@ -256,7 +268,6 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
|
|
|
}
|
|
|
var tableView:UITableView?
|
|
|
|
|
|
-
|
|
|
var communityPostDetailModel : CommunityPostDetailModel? {
|
|
|
didSet {
|
|
|
|
|
@@ -370,9 +381,10 @@ extension CommunityRecommendDetailHTMLTableViewCell: UICollectionViewDelegateFlo
|
|
|
|
|
|
extension CommunityRecommendDetailHTMLTableViewCell {
|
|
|
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
|
|
+ weak var weakself = self
|
|
|
if keyPath == "contentSize" {
|
|
|
- webViewCellHeight = self.webView.scrollView.contentSize.height
|
|
|
- tableView?.reloadData()
|
|
|
+ webViewCellHeight = weakself?.webView.scrollView.contentSize.height
|
|
|
+ weakself?.tableView?.reloadData()
|
|
|
}
|
|
|
}
|
|
|
}
|