// // StudyCollectionViewCell.swift // xingchuangke // // Created by Virgil on 2019/3/25. // Copyright © 2019 Virgil. All rights reserved. // import UIKit class ShoppingMallCollectionViewCell: UICollectionViewCell { @IBOutlet weak var view2: UIView! @IBOutlet weak var lblMoney: UILabel! @IBOutlet weak var viewContent: UIView! @IBOutlet weak var lblRemark: UILabel! @IBOutlet weak var lblTitle: UILabel! @IBOutlet weak var img: UIImageView! override func awakeFromNib() { super.awakeFromNib() // Initialization code viewContent.setSize(width: (ScreenWidth - 30) / 2, height: (ScreenWidth - 30) / 2 + 58) img.setSizeHeight(height: (ScreenWidth - 30) / 2) viewContent.setCornerRadius(size: 12) view2.marginTop(top: 0, view: img) } func initCell(rowIndex: Int, dic: NSDictionary) { if rowIndex % 2 == 0 { viewContent.marginLeft(left: 10) } else { viewContent.marginLeft(left: 5) } lblTitle.text = dic.getString(key: "name") lblRemark.text = "销量:\(dic.getInt(key: "sales_num")) | 数量:\(dic.getInt(key: "num"))" img.loadImage(imgUrl: dic.getString(key: "image"), defaultImage: "") let strPrice = "¥\(dic.getDouble(key: "price"))" lblMoney.attributedText = CommonViewUntils.getAttributedStringForFont(str: strPrice, rangs: [NSRange.init(location: 0, length: 1), NSRange.init(location: 1, length: strPrice.length() - 1)], fonts: [UIFont.systemFont(ofSize: 10), UIFont.systemFont(ofSize: 14)]) } }