Commit 03221a14 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  //  赴港
  // 深拷贝
  //  model 及其数组实现深拷贝
  //  展示选择人
parents 7d4b7d06 f84558cc
......@@ -9,7 +9,20 @@
import UIKit
import SmartCodable
class YHHKMemberModel: SmartCodable {
// [YHHKMemberModel] 数组实现神拷贝
extension Array where Element == YHHKMemberModel {
func deepCopy() -> [YHHKMemberModel] {
var results: [YHHKMemberModel] = []
for item in self {
let newItem = item.copy()
results.append(newItem as! YHHKMemberModel)
}
return results
}
}
class YHHKMemberModel: SmartCodable, NSCopying {
var id: Int = 0
var name: String = ""
......@@ -20,7 +33,8 @@ class YHHKMemberModel: SmartCodable {
var url: String = ""
var approvalDate: String = ""
var isSelectedFlag : Bool = false //本地使用
// 自定义
var isSelected : Bool = false //本地使用
enum CodingKeys: String, CodingKey {
case id = "id"
......@@ -48,6 +62,11 @@ class YHHKMemberModel: SmartCodable {
self.approvalDate = approvalDate
}
func copy(with zone: NSZone? = nil) -> Any {
return YHHKMemberModel(id: self.id, name: self.name, type: self.type, fileNum: self.fileNum, birthday: self.birthday, isCheck: self.isCheck, url: self.url, approvalDate: self.approvalDate)
}
func isAtLeast11Years() -> Bool {
return self._isAtLeast11Years(from: self.birthday)
}
......
......@@ -52,7 +52,7 @@ class YHSelectApplicantCell: UICollectionViewCell {
func updateApplicantInfo(_ applicant: YHHKMemberModel) {
nameLabel.text = applicant.name
let imgName = applicant.isSelectedFlag ? "login_privacy_agree" : "login_privacy_disagree_glay"
let imgName = applicant.isSelected ? "login_privacy_agree" : "login_privacy_disagree_glay"
selectImgView.image = UIImage(named: imgName)
}
}
......@@ -94,8 +94,8 @@ class YHSelectApplicantGroupCell: UITableViewCell {
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 16
layout.minimumInteritemSpacing = 0.0
layout.minimumLineSpacing = 16.0
let collectView = UICollectionView(frame:.zero, collectionViewLayout: layout)
collectView.delegate = self
......@@ -265,7 +265,8 @@ extension YHSelectApplicantGroupCell: UICollectionViewDelegate, UICollectionView
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: floorl(collectionView.width/3.0), height: 20)
let listWidth = KScreenWidth-(14.0+18.0+16.0)*2.0
return CGSize(width: floorl(listWidth/3.0), height: 20)
}
// 返回自定义单元格
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment