2020-02-10 17:30:11 -08:00
|
|
|
//
|
2023-04-04 14:37:11 -05:00
|
|
|
// AppBannerCollectionViewCell.swift
|
2020-02-10 17:30:11 -08:00
|
|
|
// AltStore
|
|
|
|
|
//
|
2020-03-24 13:27:44 -07:00
|
|
|
// Created by Riley Testut on 3/23/20.
|
2020-02-10 17:30:11 -08:00
|
|
|
// Copyright © 2020 Riley Testut. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
2023-10-17 14:49:13 -05:00
|
|
|
class AppBannerCollectionViewCell: UICollectionViewListCell
|
2020-02-10 17:30:11 -08:00
|
|
|
{
|
2023-04-04 14:37:11 -05:00
|
|
|
let bannerView = AppBannerView(frame: .zero)
|
2020-02-10 17:30:11 -08:00
|
|
|
|
2023-04-04 14:37:11 -05:00
|
|
|
override init(frame: CGRect)
|
|
|
|
|
{
|
|
|
|
|
super.init(frame: frame)
|
|
|
|
|
|
|
|
|
|
self.initialize()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
required init?(coder: NSCoder)
|
2020-02-10 17:30:11 -08:00
|
|
|
{
|
2023-04-04 14:37:11 -05:00
|
|
|
super.init(coder: coder)
|
2020-02-10 17:30:11 -08:00
|
|
|
|
2023-04-04 14:37:11 -05:00
|
|
|
self.initialize()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func initialize()
|
|
|
|
|
{
|
2023-10-17 14:49:13 -05:00
|
|
|
// Prevent content "squishing" when scrolling offscreen.
|
|
|
|
|
self.insetsLayoutMarginsFromSafeArea = false
|
|
|
|
|
self.contentView.insetsLayoutMarginsFromSafeArea = false
|
|
|
|
|
self.bannerView.insetsLayoutMarginsFromSafeArea = false
|
|
|
|
|
|
|
|
|
|
self.selectedBackgroundView = UIView() // Disable selection highlighting.
|
|
|
|
|
|
2020-02-10 17:30:11 -08:00
|
|
|
self.contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
|
|
|
self.contentView.preservesSuperviewLayoutMargins = true
|
2020-08-27 16:39:03 -07:00
|
|
|
|
2023-04-04 14:37:11 -05:00
|
|
|
self.bannerView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
self.contentView.addSubview(self.bannerView)
|
|
|
|
|
|
2023-03-02 16:53:36 -06:00
|
|
|
NSLayoutConstraint.activate([
|
2023-10-17 14:49:13 -05:00
|
|
|
self.bannerView.topAnchor.constraint(equalTo: self.contentView.layoutMarginsGuide.topAnchor),
|
|
|
|
|
self.bannerView.bottomAnchor.constraint(equalTo: self.contentView.layoutMarginsGuide.bottomAnchor),
|
2023-04-04 14:37:11 -05:00
|
|
|
self.bannerView.leadingAnchor.constraint(equalTo: self.contentView.layoutMarginsGuide.leadingAnchor),
|
|
|
|
|
self.bannerView.trailingAnchor.constraint(equalTo: self.contentView.layoutMarginsGuide.trailingAnchor),
|
2023-03-02 16:53:36 -06:00
|
|
|
])
|
2020-02-10 17:30:11 -08:00
|
|
|
}
|
|
|
|
|
}
|