123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- //
- // TSCollectionViewVM+Ex.swift
- // AIRingtone
- //
- // Created by 100Years on 2025/2/28.
- //
- struct TSColVVMSizeConfig {
-
- var sectionInset: UIEdgeInsets
- var lineSpacing: CGFloat
- var itemSpacing: CGFloat
-
- var originalSize:CGSize
- //一行几个cell
- var cellRowNum:Int
-
- var cellSize:CGSize
- var cellClass: UICollectionViewCell.Type
-
- var headerViewSize:CGSize
- var headerView:UICollectionReusableView.Type
-
- var footerViewSize:CGSize
- var footerView:UICollectionReusableView.Type
-
-
- }
- //MARK: 主题引导
- let themeGuideConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
- let lineSpacing = 0.0
- let itemSpacing = 0.0
-
- let originalSize = CGSizeMake(343, 109)
-
- let cellRowNum = 1
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSThemeBannerCell.self
-
- let headerViewSize = CGSize.zero
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 60)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
- //MARK: 主题内容
- let themeContentConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
- let lineSpacing = 16.0
- let itemSpacing = 16.0
-
- let originalSize = CGSizeMake(163.0, 353.0)
-
- let cellRowNum = 2
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSThemeContentCell.self
-
- let headerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
- //MARK: 海报内容
- let posterHistoryConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
- let lineSpacing = 8.0
- let itemSpacing = 8.0
-
- let originalSize = CGSizeMake(109.0, 194.0)
-
- let cellRowNum = 3
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSAIPhotoImageCell.self
-
- let headerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
- //MARK: 头像内容
- let photoHistoryConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
- let lineSpacing = 8.0
- let itemSpacing = 8.0
-
- let originalSize = CGSizeMake(109.0, 109.0)
-
- let cellRowNum = 3
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSAIPhotoImageCell.self
-
- let headerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
- //MARK: ring Categories 分类配置
- let ringCategoriesConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
- let lineSpacing = 16.0
- let itemSpacing = 16.0
-
- let originalSize = CGSizeMake(104.0, 104.0)
-
- let cellRowNum = 3
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSDiscoverCell.self
-
- let headerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
- //MARK: ring list 配置
- let ringListConfig:TSColVVMSizeConfig = {
- let sectionInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
- let lineSpacing = 13.0
- let itemSpacing = 13.0
-
- let originalSize = CGSizeMake(343.0, 72)
-
- let cellRowNum = 1
-
- let originalScale = originalSize.width/originalSize.height
- var w = k_ScreenWidth-sectionInset.left-sectionInset.right
- w = w - lineSpacing * CGFloat((cellRowNum-1))
- w = w/CGFloat(cellRowNum)
- let h = w/originalScale
-
- let cellSize = CGSizeMake(w, h)
- let cellClass = TSAIRintoneHistoryCell.self // TSDiscoverListCell.self
-
- let headerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let headerView = TSColVVMSectionHeaderView.self
- let footerViewSize = CGSizeMake(k_ScreenWidth, 0)
- let footerView = UICollectionReusableView.self
-
- var config = TSColVVMSizeConfig(
- sectionInset: sectionInset,
- lineSpacing: lineSpacing,
- itemSpacing: itemSpacing,
- originalSize: originalSize,
- cellRowNum: cellRowNum,
- cellSize: cellSize,
- cellClass: cellClass,
- headerViewSize: headerViewSize,
- headerView: headerView,
- footerViewSize: footerViewSize,
- footerView: footerView
- )
-
- return config
- }()
|