2024-05-02 19:27:51 +05:30
|
|
|
//
|
|
|
|
|
// SelectAvatarCell.swift
|
|
|
|
|
// WOKA
|
|
|
|
|
//
|
|
|
|
|
// Created by MacBook Pro on 02/05/24.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
class SelectAvatarCell: UICollectionViewCell {
|
|
|
|
|
|
2024-05-02 19:30:09 +05:30
|
|
|
@IBOutlet weak var outerView: UIView!
|
|
|
|
|
@IBOutlet weak var imageView: UIImageView!
|
|
|
|
|
|
2024-05-02 19:27:51 +05:30
|
|
|
override func awakeFromNib() {
|
|
|
|
|
super.awakeFromNib()
|
2024-05-02 19:30:09 +05:30
|
|
|
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
|
2024-05-02 19:27:51 +05:30
|
|
|
}
|
2024-05-09 18:07:59 +05:30
|
|
|
|
2024-05-02 19:30:09 +05:30
|
|
|
override func layoutSubviews() {
|
2024-05-03 20:27:54 +05:30
|
|
|
self.roundCorner()
|
2024-05-02 19:30:09 +05:30
|
|
|
}
|
|
|
|
|
|
2024-05-08 19:36:20 +05:30
|
|
|
func setData(data : AvatarDM.ResultRecords){
|
2024-05-09 18:07:59 +05:30
|
|
|
/*
|
|
|
|
|
Reset the cells
|
|
|
|
|
*/
|
|
|
|
|
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
|
|
|
|
|
|
|
|
|
|
if data.avatarName == AuthFunc.shareInstance.regData.avtar{
|
|
|
|
|
// Provide haptic feedback
|
|
|
|
|
let selectionFeedback = UISelectionFeedbackGenerator()
|
|
|
|
|
selectionFeedback.selectionChanged()
|
|
|
|
|
UIView.animate(withDuration: 0.1, animations: { [weak self] in
|
|
|
|
|
guard let self else{return}
|
|
|
|
|
imageView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
|
|
|
|
|
}) { _ in
|
|
|
|
|
UIView.animate(withDuration: 0.1) { [weak self] in
|
|
|
|
|
guard let self else{return}
|
|
|
|
|
imageView.transform = .identity
|
|
|
|
|
outerView.backgroundColor = .white
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 19:36:20 +05:30
|
|
|
if let url = data.avatarImageURL{
|
|
|
|
|
self.imageView.imageURL(url)
|
|
|
|
|
}
|
2024-05-02 19:30:09 +05:30
|
|
|
}
|
2024-05-02 19:27:51 +05:30
|
|
|
}
|