|
@@ -19,6 +19,10 @@ class KMHomeRecommondView: BaseXibView {
|
|
|
@IBOutlet var othersLabel: NSTextField!
|
|
|
@IBOutlet var othersTopConst: NSLayoutConstraint!
|
|
|
|
|
|
+ @IBOutlet var adsView: NSView!
|
|
|
+ @IBOutlet var adsImageView: NSImageView!
|
|
|
+ @IBOutlet var adsCloseBtn: NSButton!
|
|
|
+
|
|
|
|
|
|
//MARK: - func
|
|
|
override func draw(_ dirtyRect: NSRect) {
|
|
@@ -60,8 +64,9 @@ class KMHomeRecommondView: BaseXibView {
|
|
|
othersTopConst.constant = 100
|
|
|
|
|
|
var viewXValue: CGFloat = 0
|
|
|
+
|
|
|
for item: KMAdvertisementItemInfo in productContents {
|
|
|
- var view = ComponentCSelector()
|
|
|
+ let view = ComponentCSelector()
|
|
|
view.frame = CGRectMake(viewXValue, 0, 43, 24)
|
|
|
productsBGView.addSubview(view)
|
|
|
viewXValue += 55
|
|
@@ -78,8 +83,9 @@ class KMHomeRecommondView: BaseXibView {
|
|
|
if let productContents = others?.content {
|
|
|
othersBGView.isHidden = false
|
|
|
var viewYValue: CGFloat = CGRectGetHeight(othersBGView.frame) - 28 - 36
|
|
|
+
|
|
|
for item: KMAdvertisementItemInfo in productContents {
|
|
|
- var view = ComponentNavBarItem()
|
|
|
+ let view = ComponentNavBarItem()
|
|
|
view.frame = CGRectMake(0, viewYValue, CGRectGetWidth(othersBGView.frame), 36)
|
|
|
view.autoresizingMask = [.width, .minYMargin]
|
|
|
othersBGView.addSubview(view)
|
|
@@ -89,11 +95,25 @@ class KMHomeRecommondView: BaseXibView {
|
|
|
view.setTarget(self, action: #selector(othersItemClick(_:)))
|
|
|
viewYValue -= 44
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
othersBGView.isHidden = true
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ if IAPProductsManager.default().isAvailableAllFunction() {
|
|
|
+ adsView.isHidden = true
|
|
|
+ } else {
|
|
|
+ adsView.isHidden = false
|
|
|
+ let adsData = KMAdvertisementManager.manager.info.advertisement?.content
|
|
|
+ guard let model = adsData?.first else {
|
|
|
+ adsView.isHidden = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let url = URL(string: KMAdvertisementModelTransition.transitionImagePath(image: model.image, highlight: false))
|
|
|
+ self.adsImageView.image = KMAdvertisementImage.imageWithURL(url: url, completion: { [weak self] image in
|
|
|
+ self?.adsImageView.image = image
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -119,4 +139,10 @@ class KMHomeRecommondView: BaseXibView {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @IBAction func closeAdsImageview(_ sender: Any) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|